From: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
To: Oleg Nesterov <oleg@redhat.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 16:15:54 +0300 [thread overview]
Message-ID: <0eb16bca-eb0d-edd1-de6a-524f155b492b@virtuozzo.com> (raw)
In-Reply-To: <20170130125141.GA22583@redhat.com>
On 01/30/2017 03:51 PM, Oleg Nesterov wrote:
> 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 ;)
Oh, sure.
>
>> --- 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...
I'm fine with inheriting 'has' flag from real_parent, because if
real_parent does not have 'has' flag set but parent has 'has' set, we
inherited the flag in vain.
But I don't actually think that inheritance from parent not real_parent
breaks my optimization: if real_parent has the flag, so does the parent.
>
> Oleg.
>
--
Best regards, Tikhomirov Pavel
Software Developer, Virtuozzo.
next prev parent reply other threads:[~2017-01-30 13:52 UTC|newest]
Thread overview: 9+ 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
2017-01-30 13:15 ` Pavel Tikhomirov [this message]
2017-01-30 14:01 ` Oleg Nesterov
2017-01-27 10:11 ` [PATCH] prctl.2: Document new PR_SET_CHILD_SUBREAPER semantics Pavel Tikhomirov
2017-01-27 22:47 ` Michael Kerrisk (man-pages)
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=0eb16bca-eb0d-edd1-de6a-524f155b492b@virtuozzo.com \
--to=ptikhomirov@virtuozzo.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=oleg@redhat.com \
--cc=peterz@infradead.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®