Re: [PATCH 03/16] signal: remove superflous try_to_freeze() loopin do_signal_stop()

From: Oleg Nesterov
Date: Mon Dec 20 2010 - 10:06:40 EST


On 12/06, Tejun Heo wrote:
>
> do_signal_stop() is used only by get_signal_to_deliver() and after a
> successful signal stop, it always calls try_to_freeze(), so the
> try_to_freeze() loop around schedule() in do_signal_stop() is
> superflous and confusing. Remove it.

I think the patch is obvioulsy fine.

Acked-by: Oleg Nesterov <oleg@xxxxxxxxxx>



But I am a bit confused, a couple of off-topic questions to Rafael.

> --- a/kernel/signal.c
> +++ b/kernel/signal.c
> @@ -1781,9 +1781,7 @@ static int do_signal_stop(int signr)
> }
>
> /* Now we don't run again until woken by SIGCONT or SIGKILL */
> - do {
> - schedule();
> - } while (try_to_freeze());
> + schedule();

I am wondering what was the purpose of this do/while loop. Probably
this was just oversight. We always return in TASK_RUNNING state from
schedule, try_to_freeze() should return the task in this state too.

My question is: refrigerator() tries to preserve the caller's state.
Why? I think it is just wrong to call refrigerator() unless the
task is TASK_RUNNING, no? If no, then the games with saving/restoring
->state look obviously racy/wrong.

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/