[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1363247865-3531-1-git-send-email-lig.fnst@cn.fujitsu.com>
Date: Thu, 14 Mar 2013 15:57:44 +0800
From: liguang <lig.fnst@...fujitsu.com>
To: viro@...iv.linux.org.uk, oleg@...hat.com, edumazet@...gle.com,
linux-kernel@...r.kernel.org
Cc: liguang <lig.fnst@...fujitsu.com>
Subject: [PATCH 1/2] task_work: make FIFO task_work list
Signed-off-by: liguang <lig.fnst@...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 majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists