[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080918174619.GA28186@linux.vnet.ibm.com>
Date: Thu, 18 Sep 2008 10:46:19 -0700
From: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To: Manfred Spraul <manfred@...orfullife.com>
Cc: Lai Jiangshan <laijs@...fujitsu.com>, Ingo Molnar <mingo@...e.hu>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Dipankar Sarma <dipankar@...ibm.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Peter Zijlstra <peterz@...radead.org>
Subject: Re: [RFC PATCH] rcu: introduce kfree_rcu()
On Thu, Sep 18, 2008 at 06:56:11PM +0200, Manfred Spraul wrote:
> Paul E. McKenney wrote:
>> On Thu, Sep 18, 2008 at 12:18:28PM +0800, Lai Jiangshan wrote:
>>
>>> sometimes a rcu callback is just calling kfree() to free a struct's
>>> memory
>>> (we say this callback is a trivial callback.).
>>> this patch introduce kfree_rcu() to do these things directly, easily.
>>>
>>
>> Interesting! Please see questions and comments below.
>>
>>
>>> There are 4 reasons that we need kfree_rcu():
>>>
>>> 1) unloadable modules:
>>> a module(rcu callback is defined in this module) using rcu must
>>> call rcu_barrier() when unload. rcu_barrier() will increase
>>> the system's overhead(the more cpus the worse) and
>>> rcu_barrier() is very time-consuming. if all rcu callback defined
>>> in this module are trivial callback, we can just call kfree_rcu()
>>> instead, save a rcu_barrier() when unload.
>>>
> Hmm: why is rcu_barrier() sufficient to prevent races?
> Offlining a cpu reorders rcu callbacks - rcu_barrier() can return before
> all previous call_rcu() callbacks were called.
The rcu_barrier() family of functions registers a callback on each CPU,
and waits until all these callbacks have been invoked. The CPU offlining
process preserves the order of the callbacks that were registered on a
given CPU. Thus, when rcu_barrier() returns, all RCU callbacks previously
registered are guaranteed to have already been invoked, regardless of
what CPUs might have been offlined and onlined in the meantime.
Thanx, Paul
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists