From: Oleg Nesterov <oleg@redhat.com>
To: Roland McGrath <roland@redhat.com>
Cc: Frank Mayhar <fmayhar@google.com>,
Peter Zijlstra <peterz@infradead.org>,
Christoph Lameter <cl@linux-foundation.org>,
Doug Chapman <doug.chapman@hp.com>,
mingo@elte.hu, adobriyan@gmail.com, akpm@linux-foundation.org,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: regression introduced by - timers: fix itimer/many thread hang
Date: Fri, 14 Nov 2008 17:41:55 +0100 [thread overview]
Message-ID: <20081114164155.GA7738@redhat.com> (raw)
In-Reply-To: <20081114024239.07CC91541E8@magilla.localdomain>
On 11/13, Roland McGrath wrote:
>
> An idea like taking siglock in account_group_*() should be a non-starter.
Yes sure. The patch was buggy anyway, but even _if_ was correct it was
only a temporary hack for 2.6.28.
> A third variety of possible fix that we haven't explored much is to delay
> parts of the teardown to __put_task_struct or to finish_task_switch's
> TASK_DEAD case. That is, make simpler code on the tick path remain safe
> until it's no longer possible to have a tick (because it's after the final
> deschedule).
This was already discussed a bit,
http://marc.info/?l=linux-kernel&m=122640473714466
and perhaps this makes sense. With this change we can simplify other code.
> If I'm understanding it correctly, Oleg's task_rq_unlock_wait change makes
> sure that if any task_rq_lock is in effect when clearing ->signal, it's
> effectively serialized either to:
> CPU1(tsk) CPU2(parent)
> task_rq_lock(tsk)...task_rq_unlock(tsk)
> tsk->signal = NULL;
> __cleanup_signal(sig);
> or to:
> CPU1(tsk) CPU2(parent)
> tsk->signal = NULL;
> task_rq_lock(tsk)...task_rq_unlock(tsk)
> __cleanup_signal(sig);
> so that the locked "..." code either sees NULL or sees a signal_struct
> that cannot be passed to __cleanup_signal until after task_rq_unlock.
> Is that right?
>
> Doesn't the same bug exist for account_group_user_time and
> account_group_system_time? Those aren't called with task_rq_lock(current)
> held, I don't think. So Oleg's change doesn't address the whole problem,
> unless I'm missing something (which is always likely).
You are right. (please see below).
Even run_posix_cpu_timers() becomes unsafe. And I must admit, I have read
this part of the patch carefully before, and I didn't notice the problem.
I'll try to finally read the whole patch carefully on Sunday, but I don't
trust myself ;)
> The first thing that pops to my mind is to protect the freeing of
> signal_struct and thread_group_cputime_free (i.e. some or most of the
> __cleanup_signal worK) with RCU. Then use rcu_read_lock() around accesses
> to current->signal in places that can run after exit_notify,
Yes, this was my initial intent, but needs more changes. (actually,
I personally like the idea to free ->signal from __put_task_struct()
more, but I have no good arguments).
Currently I am trying to find the ugly, but simple fixes for 2.6.28.
account_group_user_time(), run_posix_cpu_timers() are simpler to
fix. Again, I need to actually read the code, but afaics we can
rely on the fact that the task is current, so we can change the
code
- if (!->signal)
+ if (->exit_state)
return;
But of course, I do agree, we need a more clever fix for the long
term, even if the change above can really help.
Oleg.
next prev parent reply other threads:[~2008-11-14 15:42 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1224694989.8431.23.camel@oberon>
[not found] ` <1225132746.14792.13.camel@bobble.smo.corp.google.com>
[not found] ` <1225219114.24204.37.camel@oberon>
2008-11-06 1:58 ` regression introduced by - timers: fix itimer/many thread hang Frank Mayhar
2008-11-06 11:03 ` Peter Zijlstra
2008-11-06 15:03 ` Christoph Lameter
2008-11-06 15:08 ` Peter Zijlstra
2008-11-06 16:08 ` Christoph Lameter
2008-11-06 23:52 ` Frank Mayhar
2008-11-07 8:35 ` Ingo Molnar
2008-11-07 10:29 ` Peter Zijlstra
2008-11-07 18:10 ` Frank Mayhar
2008-11-07 20:26 ` Peter Zijlstra
2008-11-10 14:38 ` Christoph Lameter
2008-11-10 14:42 ` Peter Zijlstra
2008-11-10 15:41 ` Christoph Lameter
2008-11-10 18:00 ` Frank Mayhar
2008-11-14 2:42 ` Roland McGrath
2008-11-14 16:41 ` Oleg Nesterov [this message]
2008-11-17 14:36 ` Oleg Nesterov
2008-11-17 18:16 ` Roland McGrath
2008-11-17 22:18 ` Oleg Nesterov
2008-11-17 21:49 ` Roland McGrath
2008-11-11 0:20 ` Ingo Oeser
2008-11-11 13:58 ` Christoph Lameter
2008-11-21 18:42 ` Petr Tesarik
2008-11-21 19:26 ` Frank Mayhar
2008-11-23 14:24 ` Peter Zijlstra
2008-11-24 8:46 ` Petr Tesarik
2008-11-24 9:33 ` Peter Zijlstra
2008-11-24 12:32 ` Petr Tesarik
2008-11-24 12:59 ` Peter Zijlstra
2008-11-24 16:06 ` Peter Zijlstra
2008-11-06 16:31 ` [PATCH] revert: " Peter Zijlstra
2008-11-06 21:44 ` Ingo Molnar
2008-11-06 21:53 ` Christoph Lameter
2008-11-07 10:19 ` Peter Zijlstra
2008-11-13 16:00 ` Doug Chapman
2008-11-13 16:08 ` Ingo Molnar
2008-11-14 14:10 ` Doug Chapman
[not found] <20081105191211.c0316b94.akpm@linux-foundation.org>
2008-11-06 12:59 ` regression introduced by - " Oleg Nesterov
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=20081114164155.GA7738@redhat.com \
--to=oleg@redhat.com \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=cl@linux-foundation.org \
--cc=doug.chapman@hp.com \
--cc=fmayhar@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox