linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Huang Ying <ying.huang@intel.com>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Len Brown <lenb@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Andi Kleen <andi@firstfloor.org>,
	"Luck, Tony" <tony.luck@intel.com>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH -v3 3/4] lib, Make gen_pool memory allocator lockless
Date: Fri, 15 Apr 2011 12:46:29 -0400	[thread overview]
Message-ID: <20110415164629.GA13983@Krystal> (raw)
In-Reply-To: <4DA7903B.5030508@intel.com>

* Huang Ying (ying.huang@intel.com) wrote:
> On 04/14/2011 05:07 AM, Mathieu Desnoyers wrote:
> > * Huang Ying (ying.huang@intel.com) wrote:
> > [...]
> >> + * rcu_read_lock and rcu_read_unlock is not used int gen_pool_alloc,
> >> + * gen_pool_free, gen_pool_avail and gen_pool_size etc, because chunks
> >> + * are only added into pool, not deleted from pool unless the pool
> >> + * itself is destroyed.  If chunk will be deleted from pool,
> >> + * rcu_read_lock and rcu_read_unlock should be uses in these
> >> + * functions.
> > 
> > So how do you protect between pool destruction and adding chunks into
> > the pool ?
> 
> Because the pool itself will be freed when destruction, we need some
> mechanism outside of pool.  For example, if gen_pool_add() is called via
> device file IOCTL, we must un-register the device file first, and
> destroy the pool after the last reference to device has gone.

I am concerned about the list_for_each_entry_rcu() (and thus
rcu_dereference_raw()) used outside of rcu_read_lock/unlock pairs.
Validation infrastructure as recently been added to RCU: it triggers
warnings when these situations are encountered in some RCU debugging
configurations. The case of RCU list iteration is not covered by the
checks, but it would make sense to be aware of it.

So although it seems like your code does not require rcu read lock
critical sections, I'd prefer to let Paul McKenney have a look.

Thanks,

Mathieu

> 
> Best Regards,
> Huang Ying

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com

  reply	other threads:[~2011-04-15 16:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-13  8:53 [PATCH -v3 0/4] ACPI, APEI, GHES, printk support for recoverable error via NMI Huang Ying
2011-04-13  8:53 ` [PATCH -v3 1/4] Add Kconfig option ARCH_HAVE_NMI_SAFE_CMPXCHG Huang Ying
2011-04-13  8:53 ` [PATCH -v3 2/4] lib, Add lock-less NULL terminated single list Huang Ying
2011-04-13 21:10   ` Mathieu Desnoyers
2011-04-13  8:53 ` [PATCH -v3 3/4] lib, Make gen_pool memory allocator lockless Huang Ying
2011-04-13 21:07   ` Mathieu Desnoyers
2011-04-14  1:29     ` Huang Ying
2011-04-15  0:24     ` Huang Ying
2011-04-15 16:46       ` Mathieu Desnoyers [this message]
2011-04-15 17:43         ` Paul E. McKenney
2011-04-15 17:44           ` Mathieu Desnoyers
2011-04-18 11:42             ` huang ying
2011-04-13  8:53 ` [PATCH -v3 4/4] ACPI, APEI, GHES, printk support for recoverable error via NMI Huang Ying

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=20110415164629.GA13983@Krystal \
    --to=mathieu.desnoyers@efficios.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=tony.luck@intel.com \
    --cc=ying.huang@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;
as well as URLs for NNTP newsgroup(s).