From: Oleg Nesterov <oleg@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Mike Galbraith <efault@gmx.de>,
hartsjc@redhat.com, vbendel@redhat.com, vlovejoy@redhat.com,
linux-kernel@vger.kernel.org
Subject: Re: sched/autogroup: race if !sysctl_sched_autogroup_enabled ?
Date: Fri, 11 Nov 2016 17:57:43 +0100 [thread overview]
Message-ID: <20161111165743.GA29869@redhat.com> (raw)
In-Reply-To: <20161110130913.GA11933@redhat.com>
On 11/10, Oleg Nesterov wrote:
>
> And the 3rd case which I didn't think about yesterday. And now I really hope
> it can explain the vmcore we have.
>
> If sysctl_sched_autogroup_enabled was enabled and then disabled, it is
> possible that the "autogrouped" process runs with ag->kref.refcount == 1,
> and if it does setsid() it frees its active task_group.
And yet another problem ;)
The exiting thread must call sched_move_task() somewhere before exit_notify()
or it can run with the freed task_group() after that. And this means that the
no-longer-needed PF_EXITING check in task_wants_autogroup() will be needed
again. Simple, but needs the comments/changelog...
> So I am going to send the patch which simply moves the sysctl check from
> autogroup_move_group() to sched_autogroup_create_attach(), but perhaps I
> should split this change?
>
> I mean, the first patch for -stable could just remove the current check,
> the 2nd one will add it into sched_autogroup_create_attach().
No, this is not enough, see above.
I am starting to think that we should just move ->autogroup from signal_struct
to task_struct. This will simplify the code and fix all these problems. But
I need a simple fix for backporting anyway.
Oleg.
next prev parent reply other threads:[~2016-11-11 16:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-09 16:59 sched/autogroup: race if !sysctl_sched_autogroup_enabled ? Oleg Nesterov
2016-11-09 17:50 ` Peter Zijlstra
2016-11-10 13:09 ` Oleg Nesterov
2016-11-11 16:57 ` Oleg Nesterov [this message]
2016-11-13 13:59 ` Mike Galbraith
2016-11-14 15:14 ` Oleg Nesterov
2016-11-12 12:12 ` Mike Galbraith
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=20161111165743.GA29869@redhat.com \
--to=oleg@redhat.com \
--cc=efault@gmx.de \
--cc=hartsjc@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=torvalds@linux-foundation.org \
--cc=vbendel@redhat.com \
--cc=vlovejoy@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.