[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170130125141.GA22583@redhat.com>
Date: Mon, 30 Jan 2017 13:51:42 +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>,
Lennart Poettering <lennart@...ttering.net>,
"Eric W . Biederman" <ebiederm@...ssion.com>,
Kay Sievers <kay.sievers@...y.org>
Subject: Re: [PATCH v2 2/2] prctl: propagate has_child_subreaper flag to
every descendant
On 01/27, Pavel Tikhomirov wrote:
>
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -1725,6 +1725,8 @@ struct task_struct {
> struct signal_struct *signal;
> struct sighand_struct *sighand;
>
> + struct list_head csr_descendant;
> +
You forgot to remove this part ;)
> --- a/kernel/fork.c
> +++ b/kernel/fork.c
> @@ -1367,9 +1367,6 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
> sig->oom_score_adj = current->signal->oom_score_adj;
> sig->oom_score_adj_min = current->signal->oom_score_adj_min;
>
> - sig->has_child_subreaper = current->signal->has_child_subreaper ||
> - current->signal->is_child_subreaper;
> -
> mutex_init(&sig->cred_guard_mutex);
>
> return 0;
> @@ -1800,6 +1797,13 @@ static __latent_entropy struct task_struct *copy_process(
>
> p->signal->leader_pid = pid;
> p->signal->tty = tty_kref_get(current->signal->tty);
> + /*
> + * Inherit has_child_subreaper flag under the same
> + * tasklist_lock with adding child to the process tree
> + * for propagate_has_child_subreaper optimization.
> + */
> + p->signal->has_child_subreaper = current->signal->has_child_subreaper ||
> + current->signal->is_child_subreaper;
Ah yes, we need this change too...
And perhaps it would be more correct to do
p->signal->has_child_subreaper =
p->real_parent->signal->has_child_subreaper ||
p->real_parent->signal->is_child_subreaper;
the current code is not exactly right if CLONE_PARENT...
Oleg.
Powered by blists - more mailing lists