From: Rik van Riel <riel@surriel.com>
To: Gargi Sharma <gs051095@gmail.com>, linux-kernel@vger.kernel.org
Cc: julia.lawall@lip6.fr, akpm@linux-foundation.org,
mingo@kernel.org, pasha.tatashin@oracle.com,
ktkhai@virtuozzo.com, oleg@redhat.com, ebiederm@xmission.com,
hch@infradead.org
Subject: Re: [PATCH v3 1/2] pid: Replace pid bitmap implementation with IDR API
Date: Fri, 06 Oct 2017 15:08:54 -0400 [thread overview]
Message-ID: <1507316934.21121.136.camel@surriel.com> (raw)
In-Reply-To: <1507290803-20708-2-git-send-email-gs051095@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1666 bytes --]
On Fri, 2017-10-06 at 07:53 -0400, Gargi Sharma wrote:
> @@ -308,8 +165,28 @@ struct pid *alloc_pid(struct pid_namespace *ns)
The code looks like it addresses all of Oleg's comments now, but the
comments could be a little clearer, IMHO.
> tmp = ns;
> pid->level = ns->level;
> +
> for (i = ns->level; i >= 0; i--) {
> - nr = alloc_pidmap(tmp);
> + int pid_min = 1;
> + idr_preload(GFP_KERNEL);
> + spin_lock_irq(&pidmap_lock);
> +
> + /*
> + * init really needs pid 1, but after reaching the
> maximum
> + * wrap back to RESERVED_PIDS
> + */
> + if (idr_get_cursor(&tmp->idr) > RESERVED_PIDS)
> + pid_min = RESERVED_PIDS;
> +
> + /*
> + * allocate a NULL pointer so that find_pid_ns can't
> + * find pid that is not fully initialized
> + */
/*
* 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);
> + spin_unlock_irq(&pidmap_lock);
> + idr_preload_end();
> +
> if (nr < 0) {
> retval = nr;
> goto out_free;
> @@ -339,6 +216,7 @@ struct pid *alloc_pid(struct pid_namespace *ns)
> for ( ; upid >= pid->numbers; --upid) {
> hlist_add_head_rcu(&upid->pid_chain,
> &pid_hash[pid_hashfn(upid->nr, upid-
> >ns)]);
/* Make the PID visible to find_pid_ns. */
> + idr_replace(&upid->ns->idr, pid, upid->nr);
> upid->ns->nr_hashed++;
> }
> spin_unlock_irq(&pidmap_lock);
>
Everything else looks great to me.
Reviewed-by: Rik van Riel <riel@redhat.com>
--
All Rights Reversed.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2017-10-06 19:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-06 11:53 [PATCH v3 0/2] Replace PID bitmap allocation with IDR API Gargi Sharma
2017-10-06 11:53 ` [PATCH v3 1/2] pid: Replace pid bitmap implementation " Gargi Sharma
2017-10-06 19:08 ` Rik van Riel [this message]
2017-10-06 11:53 ` [PATCH v3 2/2] pid: Remove pidhash Gargi Sharma
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=1507316934.21121.136.camel@surriel.com \
--to=riel@surriel.com \
--cc=akpm@linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=gs051095@gmail.com \
--cc=hch@infradead.org \
--cc=julia.lawall@lip6.fr \
--cc=ktkhai@virtuozzo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=pasha.tatashin@oracle.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.