Re: [RFC][PATCH 0/5] Signal scalability series

From: Oleg Nesterov
Date: Mon Oct 03 2011 - 09:20:18 EST

On 09/30, Matt Fleming wrote:
> On Fri, 2011-09-30 at 18:52 +0200, Oleg Nesterov wrote:
> > Hmm. Just out of curiosity, I blindly applied the whole series and poke
> > the _random_ function to look at, dequeue_signal(). And it looks wrong.
> >
> > spin_lock_irqsave(&current->signal->ctrl_lock, flags);
> > current->jobctl |= JOBCTL_STOP_DEQUEUED;
> >
> > This signal->ctrl_lock can't help. A sig_kernel_stop() should be
> > dequeued under the same lock, and we shouldn't release it unless we


> > set JOBCTL_STOP_DEQUEUED. Otherwise we race with SIGCONT.
> Hmm.. is that really a problem? Does the dequeue and setting
> JOBCTL_STOP_DEQUEUED actually need to be atomic?

It should be atomic wrt SIGCONT.

> Does it matter if we
> have SIGCONT on the signal queue when we set JOBCTL_STOP_DEQUEUED?

Why do we have? Usually SIGCONT is ignored. But this doesn't matter,
SIGCONT acts at the sending time.

If SIGCONT is sent - the process must not stop. Since we drop the lock
we can't guarantee this.

> > May be do_signal_stop() does something special? At first flance it doesn't.
> > But wait, it does while_each_thread() under ->ctrl_lock, why this is safe?
> Why is it not safe? What scenario are you thinking of where that isn't
> safe?

This series doesn't add ->ctrl_lock into copy_process/__unhash_process
or I misread the patches. This means we can't trust >thread_group list.

Even this is safe (say, we can rely on rcu), we can't calculate
->group_stop_count correctly. In particular, without ->siglock we can
race with exit_signals() which sets PF_EXITING. Note that PF_EXITING
check in task_set_jobctl_pending() is important.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at