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
17 * work is run only when the task exits the kernel and returns to user mode,
19 * it can't process this @work. Otherwise @work->func() will be called when the
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
42 work->next = head; in task_work_add()
43 } while (cmpxchg(&task->task_works, head, work) != head); in task_work_add()
73 * task_work_cancel - cancel a pending work added by task_work_add()
74 * @task: the task which should execute the work
75 * @func: identifies the work to remove
77 * Find the last queued pending work with ->func == @func and remove
81 * The found work or NULL if not found.
87 struct callback_head *work; in task_work_cancel() local
95 * new entry before this work, we will find it again. Or in task_work_cancel()
99 while ((work = READ_ONCE(*pprev))) { in task_work_cancel()
100 if (work->func != func) in task_work_cancel()
101 pprev = &work->next; in task_work_cancel()
102 else if (cmpxchg(pprev, work, work->next) == work) in task_work_cancel()
107 return work; in task_work_cancel()
116 * new work after task_work_run() returns.
121 struct callback_head *work, *head, *next; in task_work_run() local
125 * work->func() can do task_work_add(), do not set in task_work_run()
130 work = READ_ONCE(task->task_works); in task_work_run()
131 if (!work) { in task_work_run()
137 } while (cmpxchg(&task->task_works, work, head) != work); in task_work_run()
139 if (!work) in task_work_run()
143 * the first entry == work, cmpxchg(task_works) must fail. in task_work_run()
150 next = work->next; in task_work_run()
151 work->func(work); in task_work_run()
152 work = next; in task_work_run()
154 } while (work); in task_work_run()