8 #include <linux/sched.h>
15 #include <linux/export.h>
17 #include <linux/slab.h>
19 #include <linux/ptrace.h>
55 #define to_kthread(tsk) \
56 container_of((tsk)->vfork_done, struct kthread, exited)
106 *was_frozen = frozen;
125 static void __kthread_parkme(
struct kthread *
self)
143 static int kthread(
void *_create)
154 init_completion(&
self.exited);
155 init_completion(&
self.parked);
156 current->vfork_done = &
self.exited;
167 __kthread_parkme(&
self);
178 if (tsk == kthreadd_task)
179 return tsk->pref_node_fork;
194 create->
result = ERR_PTR(pid);
222 void *data,
int node,
231 init_completion(&create.
done);
233 spin_lock(&kthread_create_lock);
235 spin_unlock(&kthread_create_lock);
240 if (!IS_ERR(create.
result)) {
282 __kthread_bind(p, cpu);
298 void *data,
unsigned int cpu,
337 struct kthread *kthread = task_get_live_kthread(k);
349 __kthread_bind(k, kthread->
cpu);
370 struct kthread *kthread = task_get_live_kthread(k);
404 struct kthread *kthread = task_get_live_kthread(k);
407 trace_sched_kthread_stop(k);
417 trace_sched_kthread_stop_ret(ret);
437 if (list_empty(&kthread_create_list))
441 spin_lock(&kthread_create_lock);
442 while (!list_empty(&kthread_create_list)) {
447 list_del_init(&create->
list);
448 spin_unlock(&kthread_create_lock);
450 create_kthread(create);
452 spin_lock(&kthread_create_lock);
454 spin_unlock(&kthread_create_lock);
498 spin_lock_irq(&worker->
lock);
500 spin_unlock_irq(&worker->
lock);
505 spin_lock_irq(&worker->
lock);
509 list_del_init(&work->
node);
512 spin_unlock_irq(&worker->
lock);
554 if (list_empty(&work->
node)) {
555 insert_kthread_work(worker, work, &worker->
work_list);
558 spin_unlock_irqrestore(&worker->
lock, flags);
568 static void kthread_flush_work_fn(
struct kthread_work *work)
595 spin_lock_irq(&worker->
lock);
596 if (work->
worker != worker) {
597 spin_unlock_irq(&worker->
lock);
601 if (!list_empty(&work->
node))
602 insert_kthread_work(worker, &fwork.
work, work->
node.next);
604 insert_kthread_work(worker, &fwork.
work, worker->
work_list.next);
608 spin_unlock_irq(&worker->
lock);