From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Paul E. McKenney" Subject: Re: [PATCH] slub: fix slab_pad_check() Date: Thu, 3 Sep 2009 16:17:57 -0700 Message-ID: <20090903231757.GP6761@linux.vnet.ibm.com> References: <4A9F1620.2080105@gmail.com> <84144f020909022331x2b275aa5n428f88670e0ae8bc@mail.gmail.com> <4A9F7283.1090306@gmail.com> <4A9FCDC6.3060003@gmail.com> <4A9FDA72.8060001@gmail.com> <4AA00400.1030005@gmail.com> Reply-To: paulmck@linux.vnet.ibm.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Eric Dumazet , Pekka Enberg , Zdenek Kabelac , Patrick McHardy , Robin Holt , Linux Kernel Mailing List , Jesper Dangaard Brouer , Linux Netdev List , Netfilter Developers To: Christoph Lameter Return-path: Content-Disposition: inline In-Reply-To: Sender: netfilter-devel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org On Thu, Sep 03, 2009 at 05:44:54PM -0500, Christoph Lameter wrote: > On Thu, 3 Sep 2009, Eric Dumazet wrote: > > > It seems very smart, but needs review of all callers to make sure no slabs > > are waiting for final freeing in call_rcu queue on some cpu. > > Yes. Again this is the first time we encounter a situation where a > DESTROY_BY_RCU slab has to be destroyed. So the review is quite short. > > > I suspect most of them will then have to use rcu_barrier() before calling > > kmem_cache_destroy(), so why not factorizing code in one place ? > > There are different forms of RCU which require different forms of > barriers. Its best to leave that up to the user. Again the user must make > sure that no objects are in use before a slab is destroyed. For > SLAB_DESTROY_BY_RCU this means that there are no potential outstanding > reads on the structure. You may need an rcu_barrier() to accomplish that. > > Slight variations in the use of RCU could require different method. Better > reduce the entanglement of slabs to RCU to a mininum possible. If it were the user of the slab who was invoking some variant of call_rcu(), then I would agree with you. However, call_rcu() is instead being invoked by the slab itself in the case of SLAB_DESTROY_BY_RCU, so that there is no variation in usage. Requiring that the user call rcu_barrier() is asking for subtle bugs. Therefore, the best approach is to have kmem_cache_destroy() handle the RCU cleanup, given that this cleanup is for actions taken by kmem_cache_free(), not by the user. Thanx, Paul