[PATCH 5/6] finish_utrace_stop: check ->stopped lockless

Oleg Nesterov oleg at redhat.com
Fri Jul 31 01:06:56 UTC 2009


finish_utrace_stop() can check ->stopped lockless. It was set by us,
we can't miss it.

Signed-off-by: Oleg Nesterov <oleg at redhat.com>
----

 kernel/utrace.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- __UTRACE/kernel/utrace.c~5_FINISH_STOP	2009-07-31 02:29:32.000000000 +0200
+++ __UTRACE/kernel/utrace.c	2009-07-31 02:35:50.000000000 +0200
@@ -353,8 +353,8 @@ static inline bool finish_utrace_stop(st
 	 * utrace_wakeup() clears @utrace->stopped before waking us up.
 	 * We're officially awake if it's clear.
 	 */
-	spin_lock(&utrace->lock);
 	if (unlikely(utrace->stopped)) {
+		spin_lock(&utrace->lock);
 		/*
 		 * If we're here with it still set, it must have been
 		 * signal_wake_up() instead, waking us up for a SIGKILL.
@@ -364,8 +364,8 @@ static inline bool finish_utrace_stop(st
 		spin_unlock_irq(&task->sighand->siglock);
 		utrace->stopped = 0;
 		killed = true;
+		spin_unlock(&utrace->lock);
 	}
-	spin_unlock(&utrace->lock);
 
 	return killed;
 }




More information about the utrace-devel mailing list