* [PATCH resend v4 3/5] locking/rwsem: Don't wake up one's own task
@ 2016-05-20 23:16 Waiman Long
0 siblings, 0 replies; only message in thread
From: Waiman Long @ 2016-05-20 23:16 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar
Cc: linux-kernel, Davidlohr Bueso, Jason Low, Dave Chinner,
Peter Hurley, Paul E. McKenney, Scott J Norton, Douglas Hatch,
Waiman Long
As rwsem_down_read_failed() will queue itself and potentially call
__rwsem_do_wake(sem, RWSEM_WAKE_ANY), it is possible that a reader
will try to wake up its own task. This patch adds a check to make
sure that this won't happen.
Signed-off-by: Waiman Long <Waiman.Long@hpe.com>
Reviewed-by: Peter Hurley <peter@hurleysoftware.com>
---
kernel/locking/rwsem-xadd.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/kernel/locking/rwsem-xadd.c b/kernel/locking/rwsem-xadd.c
index c278f5a..007814f 100644
--- a/kernel/locking/rwsem-xadd.c
+++ b/kernel/locking/rwsem-xadd.c
@@ -202,7 +202,8 @@ __rwsem_do_wake(struct rw_semaphore *sem, enum rwsem_wake_type wake_type)
*/
smp_mb();
waiter->task = NULL;
- wake_up_process(tsk);
+ if (likely(tsk != current))
+ wake_up_process(tsk);
put_task_struct(tsk);
} while (--loop);
--
1.7.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-05-20 23:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-20 23:16 [PATCH resend v4 3/5] locking/rwsem: Don't wake up one's own task Waiman Long
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®