Messages in this thread Patch in this message | | | From | liguang <> | Subject | [PATCH 1/2] task_work: make FIFO task_work list | Date | Thu, 14 Mar 2013 15:57:44 +0800 |
| |
Signed-off-by: liguang <lig.fnst@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
| |