Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756551AbZICXR6 (ORCPT ); Thu, 3 Sep 2009 19:17:58 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755312AbZICXR5 (ORCPT ); Thu, 3 Sep 2009 19:17:57 -0400 Received: from e6.ny.us.ibm.com ([32.97.182.146]:60886 "EHLO e6.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755288AbZICXR4 (ORCPT ); Thu, 3 Sep 2009 19:17:56 -0400 Date: Thu, 3 Sep 2009 16:17:57 -0700 From: "Paul E. McKenney" To: Christoph Lameter Cc: Eric Dumazet , Pekka Enberg , Zdenek Kabelac , Patrick McHardy , Robin Holt , Linux Kernel Mailing List , Jesper Dangaard Brouer , Linux Netdev List , Netfilter Developers Subject: Re: [PATCH] slub: fix slab_pad_check() Message-ID: <20090903231757.GP6761@linux.vnet.ibm.com> Reply-To: paulmck@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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.15+20070412 (2007-04-11) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1810 Lines: 37 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/