Lines Matching full:task
9 * task_work_add - ask the @task to execute @work->func()
10 * @task: the task which should run the callback
12 * @notify: how to notify the targeted task
14 * Queue @work for task_work_run() below and notify the @task if @notify
16 * it will interrupt the targeted task and run the task_work. @TWA_RESUME
17 * work is run only when the task exits the kernel and returns to user mode,
18 * or before entering guest mode. Fails if the @task is exiting/exited and thus
20 * @task goes through one of the aforementioned transitions, or exits.
22 * If the targeted task is exiting, then an error is returned and the work item
32 int task_work_add(struct task_struct *task, struct callback_head *work, in task_work_add() argument
39 head = READ_ONCE(task->task_works); in task_work_add()
43 } while (cmpxchg(&task->task_works, head, work) != head); in task_work_add()
49 set_notify_resume(task); in task_work_add()
57 if (!(READ_ONCE(task->jobctl) & JOBCTL_TASK_WORK) && in task_work_add()
58 lock_task_sighand(task, &flags)) { in task_work_add()
59 task->jobctl |= JOBCTL_TASK_WORK; in task_work_add()
60 signal_wake_up(task, 0); in task_work_add()
61 unlock_task_sighand(task, &flags); in task_work_add()
74 * @task: the task which should execute the work
84 task_work_cancel(struct task_struct *task, task_work_func_t func) in task_work_cancel() argument
86 struct callback_head **pprev = &task->task_works; in task_work_cancel()
90 if (likely(!task->task_works)) in task_work_cancel()
98 raw_spin_lock_irqsave(&task->pi_lock, flags); in task_work_cancel()
105 raw_spin_unlock_irqrestore(&task->pi_lock, flags); in task_work_cancel()
114 * Called before the task returns to the user-mode or stops, or when
120 struct task_struct *task = current; in task_work_run() local
130 work = READ_ONCE(task->task_works); in task_work_run()
132 if (task->flags & PF_EXITING) in task_work_run()
137 } while (cmpxchg(&task->task_works, work, head) != work); in task_work_run()
146 raw_spin_lock_irq(&task->pi_lock); in task_work_run()
147 raw_spin_unlock_irq(&task->pi_lock); in task_work_run()