From: Oleg Nesterov <oleg@redhat.com>
To: Adrian Reber <areber@redhat.com>
Cc: Christian Brauner <christian@brauner.io>,
Eric Biederman <ebiederm@xmission.com>,
Pavel Emelianov <xemul@virtuozzo.com>,
Jann Horn <jannh@google.com>,
linux-kernel@vger.kernel.org, Andrei Vagin <avagin@gmail.com>,
Mike Rapoport <rppt@linux.ibm.com>,
Radostin Stoyanov <rstoyanov1@gmail.com>
Subject: Re: [PATCH 1/2] fork: extend clone3() to support CLONE_SET_TID
Date: Tue, 30 Jul 2019 18:55:39 +0200 [thread overview]
Message-ID: <20190730165538.GE18501@redhat.com> (raw)
In-Reply-To: <20190729163355.4530-1-areber@redhat.com>
On 07/29, Adrian Reber wrote:
>
> @@ -186,12 +187,26 @@ struct pid *alloc_pid(struct pid_namespace *ns)
> if (idr_get_cursor(&tmp->idr) > RESERVED_PIDS)
> pid_min = RESERVED_PIDS;
>
> + if (set_tid) {
> + if ((set_tid >= pid_max) || ((set_tid != 1) &&
> + (idr_get_cursor(&tmp->idr) <= 1))) {
I think the
(set_tid != 1) && idr_get_cursor() <= 1
check needs a comment...
> + spin_unlock_irq(&pidmap_lock);
> + retval = -EINVAL;
> + goto out_free;
> + }
> + min_p = set_tid;
> + max_p = set_tid + 1;
> + set_tid = 0;
> + } else {
> + min_p = pid_min;
> + max_p = pid_max;
> + }
> /*
> * Store a null pointer so find_pid_ns does not find
> * a partially initialized PID (see below).
> */
> - nr = idr_alloc_cyclic(&tmp->idr, NULL, pid_min,
> - pid_max, GFP_ATOMIC);
> + nr = idr_alloc_cyclic(&tmp->idr, NULL, min_p,
> + max_p, GFP_ATOMIC);
do we really want _cyclic() which updates idr->idr_next if set_tid?
perhaps idr_alloc() makes more sense?
Oleg.
prev parent reply other threads:[~2019-07-30 16:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-29 16:33 [PATCH 1/2] fork: extend clone3() to support CLONE_SET_TID Adrian Reber
2019-07-29 16:33 ` [PATCH 2/2] selftests: add test for clone3() with set_tid Adrian Reber
2019-07-29 19:12 ` [PATCH 1/2] fork: extend clone3() to support CLONE_SET_TID Dmitry Safonov
2019-07-29 19:17 ` Dmitry Safonov
2019-07-29 19:33 ` Christian Brauner
2019-07-30 16:55 ` Oleg Nesterov [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=20190730165538.GE18501@redhat.com \
--to=oleg@redhat.com \
--cc=areber@redhat.com \
--cc=avagin@gmail.com \
--cc=christian@brauner.io \
--cc=ebiederm@xmission.com \
--cc=jannh@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rppt@linux.ibm.com \
--cc=rstoyanov1@gmail.com \
--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;
as well as URLs for NNTP newsgroup(s).