projects
/
deliverable
/
linux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge tag 'binfmt-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb...
[deliverable/linux.git]
/
kernel
/
task_work.c
diff --git
a/kernel/task_work.c
b/kernel/task_work.c
index 6ab4842b00e8bb71db357e5933fc6c3b72669832..d513051fcca271e560eeb9e181373609cf83a65c 100644
(file)
--- a/
kernel/task_work.c
+++ b/
kernel/task_work.c
@@
-29,7
+29,7
@@
task_work_add(struct task_struct *task, struct callback_head *work, bool notify)
struct callback_head *head;
do {
struct callback_head *head;
do {
- head =
ACCESS
_ONCE(task->task_works);
+ head =
READ
_ONCE(task->task_works);
if (unlikely(head == &work_exited))
return -ESRCH;
work->next = head;
if (unlikely(head == &work_exited))
return -ESRCH;
work->next = head;
@@
-57,6
+57,9
@@
task_work_cancel(struct task_struct *task, task_work_func_t func)
struct callback_head **pprev = &task->task_works;
struct callback_head *work;
unsigned long flags;
struct callback_head **pprev = &task->task_works;
struct callback_head *work;
unsigned long flags;
+
+ if (likely(!task->task_works))
+ return NULL;
/*
* If cmpxchg() fails we continue without updating pprev.
* Either we raced with task_work_add() which added the
/*
* If cmpxchg() fails we continue without updating pprev.
* Either we raced with task_work_add() which added the
@@
-64,8
+67,7
@@
task_work_cancel(struct task_struct *task, task_work_func_t func)
* we raced with task_work_run(), *pprev == NULL/exited.
*/
raw_spin_lock_irqsave(&task->pi_lock, flags);
* we raced with task_work_run(), *pprev == NULL/exited.
*/
raw_spin_lock_irqsave(&task->pi_lock, flags);
- while ((work = ACCESS_ONCE(*pprev))) {
- smp_read_barrier_depends();
+ while ((work = lockless_dereference(*pprev))) {
if (work->func != func)
pprev = &work->next;
else if (cmpxchg(pprev, work, work->next) == work)
if (work->func != func)
pprev = &work->next;
else if (cmpxchg(pprev, work, work->next) == work)
@@
-95,7
+97,7
@@
void task_work_run(void)
* work_exited unless the list is empty.
*/
do {
* work_exited unless the list is empty.
*/
do {
- work =
ACCESS
_ONCE(task->task_works);
+ work =
READ
_ONCE(task->task_works);
head = !work && (task->flags & PF_EXITING) ?
&work_exited : NULL;
} while (cmpxchg(&task->task_works, work, head) != work);
head = !work && (task->flags & PF_EXITING) ?
&work_exited : NULL;
} while (cmpxchg(&task->task_works, work, head) != work);
This page took
0.02973 seconds
and
5
git commands to generate.