All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Cc: Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Cyrill Gorcunov <gorcunov@openvz.org>,
	John Stultz <john.stultz@linaro.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Nicolas Pitre <nicolas.pitre@linaro.org>,
	Michal Hocko <mhocko@suse.com>,
	Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>,
	Mateusz Guzik <mguzik@redhat.com>,
	linux-kernel@vger.kernel.org,
	Pavel Emelyanov <xemul@virtuozzo.com>,
	Konstantin Khorenko <khorenko@virtuozzo.com>,
	Lennart Poettering <lennart@poettering.net>,
	"Eric W . Biederman" <ebiederm@xmission.com>,
	Kay Sievers <kay.sievers@vrfy.org>
Subject: Re: [PATCH v2 2/2] prctl: propagate has_child_subreaper flag to every descendant
Date: Mon, 30 Jan 2017 13:51:42 +0100	[thread overview]
Message-ID: <20170130125141.GA22583@redhat.com> (raw)
In-Reply-To: <20170127100543.18390-3-ptikhomirov@virtuozzo.com>

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.

  reply	other threads:[~2017-01-30 12:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-27 10:05 [PATCH v2 0/2] prctl: make PR_SET_CHILD_SUBREAPER deterministic Pavel Tikhomirov
2017-01-27 10:05 ` [PATCH 1/2] introduce the walk_process_tree() helper Pavel Tikhomirov
2017-01-27 10:05 ` [PATCH v2 2/2] prctl: propagate has_child_subreaper flag to every descendant Pavel Tikhomirov
2017-01-30 12:51   ` Oleg Nesterov [this message]
2017-01-30 13:15     ` Pavel Tikhomirov
2017-01-30 14:01       ` Oleg Nesterov
     [not found] ` <20170127100543.18390-1-ptikhomirov-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
2017-01-27 10:11   ` [PATCH] prctl.2: Document new PR_SET_CHILD_SUBREAPER semantics Pavel Tikhomirov
2017-01-27 10:11     ` Pavel Tikhomirov
     [not found]     ` <20170127101125.18709-1-ptikhomirov-5HdwGun5lf+gSpxsJD1C4w@public.gmane.org>
2017-01-27 22:47       ` Michael Kerrisk (man-pages)
2017-01-27 22:47         ` Michael Kerrisk (man-pages)
     [not found]         ` <CAKgNAkhg-JankZ1LNV38DHtat5HrUKKK1YO2s1figbHQ5GMhcQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-01-28  6:38           ` Pavel Tikhomirov
2017-01-28  6:38             ` Pavel Tikhomirov

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=20170130125141.GA22583@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=ebiederm@xmission.com \
    --cc=gorcunov@openvz.org \
    --cc=john.stultz@linaro.org \
    --cc=kay.sievers@vrfy.org \
    --cc=khorenko@virtuozzo.com \
    --cc=lennart@poettering.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mguzik@redhat.com \
    --cc=mhocko@suse.com \
    --cc=mingo@redhat.com \
    --cc=nicolas.pitre@linaro.org \
    --cc=peterz@infradead.org \
    --cc=ptikhomirov@virtuozzo.com \
    --cc=skinsbursky@virtuozzo.com \
    --cc=tglx@linutronix.de \
    --cc=xemul@virtuozzo.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.