Lines Matching full:work

19  * task_work_add - ask the @task to execute @work->func()
21 * @work: the callback to run
24 * Queue @work for task_work_run() below and notify the @task if @notify
35 * @TWA_RESUME work is run only when the task exits the kernel and returns to
40 * Fails if the @task is exiting/exited and thus it can't process this @work.
41 * Otherwise @work->func() will be called when the @task goes through one of
44 * If the targeted task is exiting, then an error is returned and the work item
54 int task_work_add(struct task_struct *task, struct callback_head *work, in task_work_add() argument
65 kasan_record_aux_stack(work); in task_work_add()
72 work->next = head; in task_work_add()
73 } while (!try_cmpxchg(&task->task_works, &head, work)); in task_work_add()
101 * task_work_cancel_match - cancel a pending work added by task_work_add()
102 * @task: the task which should execute the work
107 * The found work or NULL if not found.
115 struct callback_head *work; in task_work_cancel_match() local
123 * new entry before this work, we will find it again. Or in task_work_cancel_match()
127 work = READ_ONCE(*pprev); in task_work_cancel_match()
128 while (work) { in task_work_cancel_match()
129 if (!match(work, data)) { in task_work_cancel_match()
130 pprev = &work->next; in task_work_cancel_match()
131 work = READ_ONCE(*pprev); in task_work_cancel_match()
132 } else if (try_cmpxchg(pprev, &work, work->next)) in task_work_cancel_match()
137 return work; in task_work_cancel_match()
146 * task_work_cancel_func - cancel a pending work matching a function added by task_work_add()
147 * @task: the task which should execute the func's work
148 * @func: identifies the func to match with a work to remove
150 * Find the last queued pending work with ->func == @func and remove
154 * The found work or NULL if not found.
168 * task_work_cancel - cancel a pending work added by task_work_add()
169 * @task: the task which should execute the work
192 * new work after task_work_run() returns.
197 struct callback_head *work, *head, *next; in task_work_run() local
201 * work->func() can do task_work_add(), do not set in task_work_run()
204 work = READ_ONCE(task->task_works); in task_work_run()
207 if (!work) { in task_work_run()
213 } while (!try_cmpxchg(&task->task_works, &work, head)); in task_work_run()
215 if (!work) in task_work_run()
219 * the first entry == work, cmpxchg(task_works) must fail. in task_work_run()
226 next = work->next; in task_work_run()
227 work->func(work); in task_work_run()
228 work = next; in task_work_run()
230 } while (work); in task_work_run()