public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Rik van Riel <riel@surriel.com>,
	Gargi Sharma <gs051095@gmail.com>,
	linux-kernel@vger.kernel.org, julia.lawall@lip6.fr,
	mingo@kernel.org, pasha.tatashin@oracle.com,
	ktkhai@virtuozzo.com, ebiederm@xmission.com, hch@infradead.org,
	lkp@intel.com, tony.luck@intel.com
Subject: Re: [PATCH v6 1/2] pid: Replace pid bitmap implementation with IDR API
Date: Fri, 13 Oct 2017 16:58:55 +0200	[thread overview]
Message-ID: <20171013145855.GB23154@redhat.com> (raw)
In-Reply-To: <20171012155850.1f38f3a6fd14c669343d4492@linux-foundation.org>

On 10/12, Andrew Morton wrote:
>
> On Wed, 11 Oct 2017 20:54:32 -0400 Rik van Riel <riel@surriel.com> wrote:
>
> > Documenting the locking on all the existing code, plus the
> > new code, seems a little out of scope of an Outreachy
> > internship...
>
> I'm not referring to all the existing code!  Just this new
> pid_namespace.idr's locking.  If it was protected by
> spin_lock_irq(&pidmap_lock) everywhere then an explanation wouldn't be
> needed.  But we have this oddball site where pidmap_lock isn't taken
> but it uses rcu_read_lock() which is surprising to say the least.
> Readers could be forgiven for thinking that is a bug.

Actually this all looks simple, or I missed something...

pid_namespace.idr is protected by pidmap_lock, it is always modified
with this lock held.

idr_find/idr_find_ext/etc can be called under rcu_read_lock() simply
because idr/radix_tree is rcu-safe and this is already documented in
idr.h, say, the comment above idr_find() says

 * This function can be called under rcu_read_lock(), given that the leaf
 * pointers lifetimes are correctly managed.

Oleg.

  reply	other threads:[~2017-10-13 14:59 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-11 22:19 [PATCH v6 0/2] Replacing PID bitmap implementation with IDR API Gargi Sharma
2017-10-11 22:19 ` [PATCH v6 1/2] pid: Replace pid " Gargi Sharma
2017-10-11 22:28   ` Rik van Riel
2017-10-11 22:37   ` Andrew Morton
2017-10-12  0:54     ` Rik van Riel
2017-10-12 22:58       ` Andrew Morton
2017-10-13 14:58         ` Oleg Nesterov [this message]
2017-10-19  7:30   ` [v6,1/2] " Andrei Vagin
2017-10-19 13:20     ` Gargi Sharma
2017-10-19 16:18     ` Oleg Nesterov
2017-10-20 16:06       ` Gargi Sharma
2017-10-20 17:21         ` Andrei Vagin
2017-10-22  8:05           ` Gargi Sharma
2017-10-23 15:31             ` Oleg Nesterov
2017-10-11 22:19 ` [PATCH v6 2/2] pid: Remove pidhash Gargi Sharma
2017-10-11 22:28   ` Rik van Riel
2017-10-11 22:47   ` Luck, Tony

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=20171013145855.GB23154@redhat.com \
    --to=oleg@redhat.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=lkp@intel.com \
    --cc=mingo@kernel.org \
    --cc=pasha.tatashin@oracle.com \
    --cc=riel@surriel.com \
    --cc=tony.luck@intel.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