On Thu, Feb 20, 2020 at 01:31:47PM -0700, Jens Axboe wrote: > @@ -27,39 +43,25 @@ static struct callback_head work_exited; /* all we need is ->next == NULL */ > int > task_work_add(struct task_struct *task, struct callback_head *work, bool notify) > { > - struct callback_head *head; > + int ret; > > - do { > - head = READ_ONCE(task->task_works); > - if (unlikely(head == &work_exited)) > - return -ESRCH; > - work->next = head; > - } while (cmpxchg(&task->task_works, head, work) != head); > + ret = __task_work_add(task, &task->task_works, work); > > if (notify) if (!ret && notify) > set_notify_resume(task); > - return 0; > + > + return ret; > }