[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170123120735.GC11827@redhat.com>
Date: Mon, 23 Jan 2017 13:07:35 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: Pavel Tikhomirov <ptikhomirov@...tuozzo.com>
Cc: Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Cyrill Gorcunov <gorcunov@...nvz.org>,
John Stultz <john.stultz@...aro.org>,
Thomas Gleixner <tglx@...utronix.de>,
Nicolas Pitre <nicolas.pitre@...aro.org>,
Michal Hocko <mhocko@...e.com>,
Stanislav Kinsburskiy <skinsbursky@...tuozzo.com>,
Mateusz Guzik <mguzik@...hat.com>,
linux-kernel@...r.kernel.org,
Pavel Emelyanov <xemul@...tuozzo.com>,
Konstantin Khorenko <khorenko@...tuozzo.com>
Subject: Re: [PATCH] introduce the walk_process_tree() helper
On 01/23, Oleg Nesterov wrote:
>
> Add the new helper to walk the process tree, the next patch adds a user.
> Note that it visits the group leaders only, proc_visitor can do
> for_each_thread itself or we can trivially extend walk_process_tree() to
> do this.
Please consider this patch as a preparation for your change, or feel free
to fold this code into your patch.
Now you can simply do
int xxx(struct task_struct *p, void *data)
{
if (p->signal->has_child_subreaper ||
is_child_reaper(task_pid(p))
return 0;
p->signal->has_child_subreaper = 1;
return 1;
}
walk_process_tree(xxx, NULL);
walk_process_tree() handles the sub-threads correctly, but "p" is always the
leader so is_child_reaper() is fine, but probably we need a new helper anyway.
Oleg.
Powered by blists - more mailing lists