mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jim Newsome <jnewsome@torproject.org>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	"Eric W . Biederman" <ebiederm@xmission.com>,
	Christian Brauner <christian@brauner.io>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4] do_wait: make PIDTYPE_PID case O(1) instead of O(n)
Date: Fri, 12 Mar 2021 10:51:29 -0600	[thread overview]
Message-ID: <24b32f84-c2d9-3b14-0e7b-a56d719a4a1d@torproject.org> (raw)
In-Reply-To: <20210312164119.GC27820@redhat.com>


On 3/12/21 10:41, Oleg Nesterov wrote:
> On 03/11, Jim Newsome wrote:
>> +
>> +	if (target && is_effectively_child(wo, ptrace, target)) {
>> +		retval = wait_consider_task(wo, ptrace, target);
> No, this is not right... You need to check target->ptrace != 0.

Shoot; got lost in the shuffle. Sorry about that and thanks for catching!

> I know that Eric suggests to not use thread_group_leader() and I won't argue
> even if I don't really agree.
>
> Up to you, but to me something like
>
> 	do_wait_pid()
> 	{
> 		target = pid_task(wo->wo_pid, PIDTYPE_PID);
>
> 		if (!target)
> 			return 0;
>
> 		if (thread_group_leader(target) &&
> 		    is_effectively_child(wo, 0, target) {
> 			...			
> 		}
>
> 		if (target->ptrace &&
> 		    is_effectively_child(wo, 1, target) {
> 			...
> 		}
>
> 		return 0;
>
> 	}
>
> looks more simple/clean.

I like that a little better too. I'll go this way since Eric seemed Ok
with either way.

If we do that then it might make sense to move the `thread_group_leader`
filter into `is_effectively_child`, but maybe that obscures what the
latter is doing too much. It'd at least have to be renamed, and I'm not
sure of a clear name that'd capture exactly what it's doing. Maybe
`is_valid_waitee`?

If I don't hear anything I'll just go with how you've already proposed.

v5 coming in a bit. I'll drop your (Oleg's) reviewed-by since it's
changed substantially since then.


      reply	other threads:[~2021-03-12 16:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-11 23:38 Jim Newsome
2021-03-12 16:41 ` Oleg Nesterov
2021-03-12 16:51   ` Jim Newsome [this message]

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=24b32f84-c2d9-3b14-0e7b-a56d719a4a1d@torproject.org \
    --to=jnewsome@torproject.org \
    --cc=akpm@linux-foundation.org \
    --cc=christian@brauner.io \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.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®