Lines Matching full:work
9 * task_work_add - ask the @task to execute @work->func()
11 * @work: the callback to run
14 * Queue @work for task_work_run() below and notify the @task if @notify
25 * @TWA_RESUME work is run only when the task exits the kernel and returns to
28 * Fails if the @task is exiting/exited and thus it can't process this @work.
29 * Otherwise @work->func() will be called when the @task goes through one of
32 * If the targeted task is exiting, then an error is returned and the work item
42 int task_work_add(struct task_struct *task, struct callback_head *work, in task_work_add() argument
47 /* record the work call stack in order to print it in KASAN reports */ in task_work_add()
48 kasan_record_aux_stack(work); in task_work_add()
54 work->next = head; in task_work_add()
55 } while (!try_cmpxchg(&task->task_works, &head, work)); in task_work_add()
78 * task_work_cancel_match - cancel a pending work added by task_work_add()
79 * @task: the task which should execute the work
83 * The found work or NULL if not found.
91 struct callback_head *work; in task_work_cancel_match() local
99 * new entry before this work, we will find it again. Or in task_work_cancel_match()
103 work = READ_ONCE(*pprev); in task_work_cancel_match()
104 while (work) { in task_work_cancel_match()
105 if (!match(work, data)) { in task_work_cancel_match()
106 pprev = &work->next; in task_work_cancel_match()
107 work = READ_ONCE(*pprev); in task_work_cancel_match()
108 } else if (try_cmpxchg(pprev, &work, work->next)) in task_work_cancel_match()
113 return work; in task_work_cancel_match()
122 * task_work_cancel - cancel a pending work added by task_work_add()
123 * @task: the task which should execute the work
124 * @func: identifies the work to remove
126 * Find the last queued pending work with ->func == @func and remove
130 * The found work or NULL if not found.
144 * new work after task_work_run() returns.
149 struct callback_head *work, *head, *next; in task_work_run() local
153 * work->func() can do task_work_add(), do not set in task_work_run()
156 work = READ_ONCE(task->task_works); in task_work_run()
159 if (!work) { in task_work_run()
165 } while (!try_cmpxchg(&task->task_works, &work, head)); in task_work_run()
167 if (!work) in task_work_run()
171 * the first entry == work, cmpxchg(task_works) must fail. in task_work_run()
178 next = work->next; in task_work_run()
179 work->func(work); in task_work_run()
180 work = next; in task_work_run()
182 } while (work); in task_work_run()