From: Peter Zijlstra <peterz@infradead.org>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>,
adobriyan@gmail.com, Doug Chapman <doug.chapman@hp.com>,
Roland McGrath <roland@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] account_group_exec_runtime: fix the racy usage of ->signal
Date: Mon, 10 Nov 2008 13:13:26 +0100 [thread overview]
Message-ID: <1226319206.7685.27.camel@twins> (raw)
In-Reply-To: <20081110130404.GA10294@redhat.com>
On Mon, 2008-11-10 at 14:04 +0100, Oleg Nesterov wrote:
> On 11/08, Ingo Molnar wrote:
> >
> > * Oleg Nesterov <oleg@redhat.com> wrote:
> >
> > > On 11/07, Ingo Molnar wrote:
> > > >
> > > > the signal lock must not nest inside the rq
> > > > lock, and these accounting functions are called from within the
> > > > scheduler.
> > >
> > > Why? we seem to never do task_rq_lock() under ->siglock ?
> >
> > signal_wake_up() ?
>
> I'd wish very much I could say I have already realized this, but I didn't.
> Thanks Ingo!
>
> I don't see the good solution for this problem. I'll send the new patch in
> a minute, but it is ugly. Basically it is
>
> --- a/kernel/exit.c
> +++ b/kernel/exit.c
> @@ -141,6 +141,8 @@ static void __exit_signal(struct task_st
> if (sig) {
> flush_sigqueue(&sig->shared_pending);
> taskstats_tgid_free(sig);
> + smp_mb();
> + spin_unlock_wait(&task_rq(tsk)->lock);
> __cleanup_signal(sig);
> }
> }
>
> except this needs a helper in sched.c. You can nack it right now ;)
> Of course we can protect ->signal with rcu, but this is even worse
> imho.
>
> Anybody sees a bettter fix?
>
>
> Perhaps we can change sched.c to do update_curr() only when the
> task is not running (except ->task_tick), iow perhaps we can check
> sleep/wakeup == T before calling update_cur(). But this is not easy
> even if really possible.
and butt ugly to boot..
prev parent reply other threads:[~2008-11-10 12:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-07 16:52 [PATCH] account_group_exec_runtime: fix the racy usage of ->signal Oleg Nesterov
2008-11-07 16:21 ` Ingo Molnar
2008-11-07 16:58 ` Doug Chapman
2008-11-07 18:42 ` Oleg Nesterov
2008-11-07 17:40 ` Oleg Nesterov
2008-11-08 9:28 ` Ingo Molnar
2008-11-10 13:04 ` Oleg Nesterov
2008-11-10 12:13 ` Peter Zijlstra [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1226319206.7685.27.camel@twins \
--to=peterz@infradead.org \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=doug.chapman@hp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=oleg@redhat.com \
--cc=roland@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.