Lines Matching full:work

24  * task_work_add - ask the @task to execute @work->func()
26 * @work: the callback to run
29 * Queue @work for task_work_run() below and notify the @task if @notify
40 * @TWA_RESUME work is run only when the task exits the kernel and returns to
45 * Fails if the @task is exiting/exited and thus it can't process this @work.
46 * Otherwise @work->func() will be called when the @task goes through one of
49 * If the targeted task is exiting, then an error is returned and the work item
59 int task_work_add(struct task_struct *task, struct callback_head *work, in task_work_add() argument
70 kasan_record_aux_stack(work); in task_work_add()
77 work->next = head; in task_work_add()
78 } while (!try_cmpxchg(&task->task_works, &head, work)); in task_work_add()
107 * task_work_cancel_match - cancel a pending work added by task_work_add()
108 * @task: the task which should execute the work
113 * The found work or NULL if not found.
121 struct callback_head *work; in task_work_cancel_match() local
129 * new entry before this work, we will find it again. Or in task_work_cancel_match()
133 work = READ_ONCE(*pprev); in task_work_cancel_match()
134 while (work) { in task_work_cancel_match()
135 if (!match(work, data)) { in task_work_cancel_match()
136 pprev = &work->next; in task_work_cancel_match()
137 work = READ_ONCE(*pprev); in task_work_cancel_match()
138 } else if (try_cmpxchg(pprev, &work, work->next)) in task_work_cancel_match()
143 return work; in task_work_cancel_match()
152 * task_work_cancel_func - cancel a pending work matching a function added by task_work_add()
153 * @task: the task which should execute the func's work
154 * @func: identifies the func to match with a work to remove
156 * Find the last queued pending work with ->func == @func and remove
160 * The found work or NULL if not found.
174 * task_work_cancel - cancel a pending work added by task_work_add()
175 * @task: the task which should execute the work
198 * new work after task_work_run() returns.
203 struct callback_head *work, *head, *next; in task_work_run() local
207 * work->func() can do task_work_add(), do not set in task_work_run()
210 work = READ_ONCE(task->task_works); in task_work_run()
213 if (!work) { in task_work_run()
219 } while (!try_cmpxchg(&task->task_works, &work, head)); in task_work_run()
221 if (!work) in task_work_run()
225 * the first entry == work, cmpxchg(task_works) must fail. in task_work_run()
232 next = work->next; in task_work_run()
233 work->func(work); in task_work_run()
234 work = next; in task_work_run()
236 } while (work); in task_work_run()