Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 365318
b: refs/heads/master
c: b5c5442
h: refs/heads/master
v: v3
  • Loading branch information
Oleg Nesterov authored and Linus Torvalds committed Apr 29, 2013
1 parent 4cf2fcf commit 3fe2c70
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4ecdafc8084fe1d95bb59ed7753b345abcd586fb
refs/heads/master: b5c5442bb6bce0c67701d55124be561043a51faf
20 changes: 7 additions & 13 deletions trunk/kernel/kthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,6 @@ struct task_struct *kthread_create_on_cpu(int (*threadfn)(void *data),
return p;
}

static struct kthread *task_get_live_kthread(struct task_struct *k)
{
get_task_struct(k);
return to_live_kthread(k);
}

static void __kthread_unpark(struct task_struct *k, struct kthread *kthread)
{
clear_bit(KTHREAD_SHOULD_PARK, &kthread->flags);
Expand All @@ -356,11 +350,10 @@ static void __kthread_unpark(struct task_struct *k, struct kthread *kthread)
*/
void kthread_unpark(struct task_struct *k)
{
struct kthread *kthread = task_get_live_kthread(k);
struct kthread *kthread = to_live_kthread(k);

if (kthread)
__kthread_unpark(k, kthread);
put_task_struct(k);
}

/**
Expand All @@ -377,7 +370,7 @@ void kthread_unpark(struct task_struct *k)
*/
int kthread_park(struct task_struct *k)
{
struct kthread *kthread = task_get_live_kthread(k);
struct kthread *kthread = to_live_kthread(k);
int ret = -ENOSYS;

if (kthread) {
Expand All @@ -390,7 +383,6 @@ int kthread_park(struct task_struct *k)
}
ret = 0;
}
put_task_struct(k);
return ret;
}

Expand All @@ -411,21 +403,23 @@ int kthread_park(struct task_struct *k)
*/
int kthread_stop(struct task_struct *k)
{
struct kthread *kthread = task_get_live_kthread(k);
struct kthread *kthread;
int ret;

trace_sched_kthread_stop(k);

get_task_struct(k);
kthread = to_live_kthread(k);
if (kthread) {
set_bit(KTHREAD_SHOULD_STOP, &kthread->flags);
__kthread_unpark(k, kthread);
wake_up_process(k);
wait_for_completion(&kthread->exited);
}
ret = k->exit_code;

put_task_struct(k);
trace_sched_kthread_stop_ret(ret);

trace_sched_kthread_stop_ret(ret);
return ret;
}
EXPORT_SYMBOL(kthread_stop);
Expand Down

0 comments on commit 3fe2c70

Please sign in to comment.