- Nobody uses the (inaccurate) value returned by utrace_stop(), change it to return void.
- use fatal_signal_pending() instead of sigismember(SIGKILL). - finish_utrace_stop() becomes really trivial, it just clears ->stopped. Fold it into utrace_stop(). Signed-off-by: Oleg Nesterov <o...@redhat.com> --- kernel/utrace.c | 57 ++++++++++++++++---------------------------------------- 1 file changed, 17 insertions(+), 40 deletions(-) --- __UTRACE/kernel/utrace.c~3_STOP_DONT_CK_KILLED 2009-08-14 13:26:51.000000000 +0200 +++ __UTRACE/kernel/utrace.c 2009-08-14 13:54:54.000000000 +0200 @@ -341,44 +341,12 @@ static const struct utrace_engine_ops ut }; /* - * After waking up from TASK_TRACED, clear bookkeeping in @utrace. - * Returns true if we were woken up prematurely by SIGKILL. - */ -static inline bool finish_utrace_stop(struct task_struct *task, - struct utrace *utrace) -{ - bool killed = false; - - /* - * utrace_wakeup() clears @utrace->stopped before waking us up. - * We're officially awake if it's clear. - */ - if (unlikely(utrace->stopped)) { - /* - * If we're here with it still set, it must have been - * signal_wake_up() instead, waking us up for a SIGKILL. - */ - WARN_ON(!__fatal_signal_pending(task)); - spin_lock(&utrace->lock); - utrace->stopped = 0; - spin_unlock(&utrace->lock); - killed = true; - } - - return killed; -} - -/* * Perform %UTRACE_STOP, i.e. block in TASK_TRACED until woken up. * @task == current, @utrace == current->utrace, which is not locked. - * Return true if we were woken up by SIGKILL even though some utrace - * engine may still want us to stay stopped. */ -static bool utrace_stop(struct task_struct *task, struct utrace *utrace, +static void utrace_stop(struct task_struct *task, struct utrace *utrace, bool report) { - bool killed; - /* * @utrace->stopped is the flag that says we are safely * inside this function. It should never be set on entry. @@ -393,10 +361,10 @@ static bool utrace_stop(struct task_stru spin_lock(&utrace->lock); spin_lock_irq(&task->sighand->siglock); - if (unlikely(sigismember(&task->pending.signal, SIGKILL))) { + if (unlikely(fatal_signal_pending(task))) { spin_unlock_irq(&task->sighand->siglock); spin_unlock(&utrace->lock); - return true; + return; } if (report) { @@ -429,9 +397,20 @@ static bool utrace_stop(struct task_stru * frozen that we freeze now before running anything substantial. */ try_to_freeze(); - - killed = finish_utrace_stop(task, utrace); - + /* + * utrace_wakeup() clears @utrace->stopped before waking us up. + * We're officially awake if it's clear. + */ + if (unlikely(utrace->stopped)) { + /* + * If we're here with it still set, it must have been + * signal_wake_up() instead, waking us up for a SIGKILL. + */ + WARN_ON(!__fatal_signal_pending(task)); + spin_lock(&utrace->lock); + utrace->stopped = 0; + spin_unlock(&utrace->lock); + } /* * While we were in TASK_TRACED, complete_signal() considered * us "uninterested" in signal wakeups. Now make sure our @@ -440,8 +419,6 @@ static bool utrace_stop(struct task_stru spin_lock_irq(&task->sighand->siglock); recalc_sigpending(); spin_unlock_irq(&task->sighand->siglock); - - return killed; } /*