diff options
| author | 2017-11-13 10:24:50 +0100 | |
|---|---|---|
| committer | 2017-11-13 10:24:50 +0100 | |
| commit | 3a485c2be49dde899e506684bb5f06d5b3f73e82 (patch) | |
| tree | e013f4d121199d60b70043f525aef4a7e641b5f6 /kernel/task_work.c | |
| parent | Linux 4.13 (diff) | |
| parent | Linux 4.14 (diff) | |
Merge tag 'v4.14' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/torvalds/linux
Linux 4.14
Diffstat (limited to 'kernel/task_work.c')
| -rw-r--r-- | kernel/task_work.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/kernel/task_work.c b/kernel/task_work.c index d513051fcca2..5718b3ea202a 100644 --- a/kernel/task_work.c +++ b/kernel/task_work.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/spinlock.h> #include <linux/task_work.h> #include <linux/tracehook.h> @@ -96,20 +97,16 @@ void task_work_run(void) * work->func() can do task_work_add(), do not set * work_exited unless the list is empty. */ + raw_spin_lock_irq(&task->pi_lock); do { work = READ_ONCE(task->task_works); head = !work && (task->flags & PF_EXITING) ? &work_exited : NULL; } while (cmpxchg(&task->task_works, work, head) != work); + raw_spin_unlock_irq(&task->pi_lock); if (!work) break; - /* - * Synchronize with task_work_cancel(). It can't remove - * the first entry == work, cmpxchg(task_works) should - * fail, but it can play with *work and other entries. - */ - raw_spin_unlock_wait(&task->pi_lock); do { next = work->next; |
