[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20111003131610.GA26823@redhat.com>
Date: Mon, 3 Oct 2011 15:16:10 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Matt Fleming <matt@...sole-pimps.org>
Cc: Tejun Heo <tj@...nel.org>, linux-kernel@...r.kernel.org,
Tony Luck <tony.luck@...el.com>
Subject: Re: [RFC][PATCH 0/5] Signal scalability series
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(¤t->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
s/unless/until/
> > 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.
Oleg.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists