From: Oleg Nesterov <oleg@redhat.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: linux-mm@kvack.org, David Rientjes <rientjes@google.com>,
Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
Johannes Weiner <hannes@cmpxchg.org>,
Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>,
Michal Hocko <mhocko@suse.com>, Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: [PATCH 3/4] mm, oom: do not rely on TIF_MEMDIE for exit_oom_victim
Date: Tue, 4 Oct 2016 18:21:14 +0200 [thread overview]
Message-ID: <20161004162114.GB32428@redhat.com> (raw)
In-Reply-To: <20161004090009.7974-4-mhocko@kernel.org>
On 10/04, Michal Hocko wrote:
>
> -void release_task(struct task_struct *p)
> +bool release_task(struct task_struct *p)
> {
> struct task_struct *leader;
> int zap_leader;
> + bool last = false;
> repeat:
> /* don't need to get the RCU readlock here - the process is dead and
> * can't be modifying its own credentials. But shut RCU-lockdep up */
> @@ -197,8 +198,10 @@ void release_task(struct task_struct *p)
> * then we are the one who should release the leader.
> */
> zap_leader = do_notify_parent(leader, leader->exit_signal);
> - if (zap_leader)
> + if (zap_leader) {
> leader->exit_state = EXIT_DEAD;
> + last = true;
> + }
> }
This looks strange... it won't return true if "p" is the group leader.
> @@ -584,12 +587,15 @@ static void forget_original_parent(struct task_struct *father,
> /*
> * Send signals to all our closest relatives so that they know
> * to properly mourn us..
> + *
> + * Returns true if this is the last thread from the thread group
> */
> -static void exit_notify(struct task_struct *tsk, int group_dead)
> +static bool exit_notify(struct task_struct *tsk, int group_dead)
> {
> bool autoreap;
> struct task_struct *p, *n;
> LIST_HEAD(dead);
> + bool last = false;
>
> write_lock_irq(&tasklist_lock);
> forget_original_parent(tsk, &dead);
> @@ -606,6 +612,7 @@ static void exit_notify(struct task_struct *tsk, int group_dead)
> } else if (thread_group_leader(tsk)) {
> autoreap = thread_group_empty(tsk) &&
> do_notify_parent(tsk, tsk->exit_signal);
> + last = thread_group_empty(tsk);
so this can't detect the multi-threaded group exit, and ...
> list_for_each_entry_safe(p, n, &dead, ptrace_entry) {
> list_del_init(&p->ptrace_entry);
> - release_task(p);
> + if (release_task(p) && p == tsk)
> + last = true;
this can only happen if this process auto-reaps itself. Not to mention
that exit_notify() will never return true if traced.
No, this doesn't look right.
Oleg.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2016-10-04 16:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-04 9:00 [PATCH 0/4] mm, oom: get rid of TIF_MEMDIE Michal Hocko
2016-10-04 9:00 ` [PATCH 1/4] mm, oom: do not rely on TIF_MEMDIE for memory reserves access Michal Hocko
2016-10-04 9:00 ` [PATCH 2/4] mm: replace TIF_MEMDIE checks by tsk_is_oom_victim Michal Hocko
2016-10-04 9:00 ` [PATCH 3/4] mm, oom: do not rely on TIF_MEMDIE for exit_oom_victim Michal Hocko
2016-10-04 16:21 ` Oleg Nesterov [this message]
2016-10-05 9:37 ` Michal Hocko
2016-10-04 9:00 ` [PATCH 4/4] arch: get rid of TIF_MEMDIE Michal Hocko
2016-10-05 12:04 ` [PATCH 0/4] mm, oom: " Michal Hocko
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=20161004162114.GB32428@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=mhocko@suse.com \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=rientjes@google.com \
--cc=viro@zeniv.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).