Signed-off-by: liguang <lig.f...@cn.fujitsu.com> --- kernel/task_work.c | 15 +++------------ 1 files changed, 3 insertions(+), 12 deletions(-)
diff --git a/kernel/task_work.c b/kernel/task_work.c index 65bd3c9..0bf4258 100644 --- a/kernel/task_work.c +++ b/kernel/task_work.c @@ -13,11 +13,12 @@ task_work_add(struct task_struct *task, struct callback_head *work, bool notify) head = ACCESS_ONCE(task->task_works); if (unlikely(head == &work_exited)) return -ESRCH; - work->next = head; - } while (cmpxchg(&task->task_works, head, work) != head); + head = head->next; + } while (cmpxchg(&head, NULL, work) == head); if (notify) set_notify_resume(task); + return 0; } @@ -72,16 +73,6 @@ void task_work_run(void) raw_spin_unlock_wait(&task->pi_lock); smp_mb(); - /* Reverse the list to run the works in fifo order */ - head = NULL; - do { - next = work->next; - work->next = head; - head = work; - work = next; - } while (work); - - work = head; do { next = work->next; work->func(work); -- 1.7.2.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/