From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Dumazet Subject: Re: [PATCH] slub: fix slab_pad_check() Date: Thu, 03 Sep 2009 17:02:10 +0200 Message-ID: <4A9FDA72.8060001@gmail.com> References: <4A87CE60.4020506@gmail.com> <4A896324.3040104@trash.net> <4A9EEF07.5070800@gmail.com> <4A9F1620.2080105@gmail.com> <84144f020909022331x2b275aa5n428f88670e0ae8bc@mail.gmail.com> <4A9F7283.1090306@gmail.com> <4A9FCDC6.3060003@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Pekka Enberg , Zdenek Kabelac , Patrick McHardy , Robin Holt , Linux Kernel Mailing List , Jesper Dangaard Brouer , Linux Netdev List , Netfilter Developers , paulmck@linux.vnet.ibm.com To: Christoph Lameter Return-path: Received: from gw1.cosmosbay.com ([212.99.114.194]:35986 "EHLO gw1.cosmosbay.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753328AbZICPCr (ORCPT ); Thu, 3 Sep 2009 11:02:47 -0400 In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: Christoph Lameter a =E9crit : > On Thu, 3 Sep 2009, Eric Dumazet wrote: >=20 >> Christoph Lameter a ?crit : >>> On Thu, 3 Sep 2009, Eric Dumazet wrote: >>> >>>> on a SLAB_DESTROY_BY_RCU cache, there is no need to try to optimiz= e this >>>> rcu_barrier() call, unless we want superfast reboot/halt sequences= =2E.. >>> I stilll think that the action to quiesce rcu is something that the= caller >>> of kmem_cache_destroy must take care of. >> Do you mean : >> >> if (kmem_cache_shrink(s) =3D=3D 0) { >> rcu_barrier(); >> kmem_cache_destroy_no_rcu_barrier(s); >> } else { >> kmem_cache_destroy_with_rcu_barrier_because_SLAB_DESTROY_BY_RCU_cac= he(s); >> } >> >> What would be the point ? >=20 > The above is port of slub? No, I am trying to code what you suggest, and I could not find a clean = way with current API (SLAB/SLUB/SLOB) >=20 > I mean that (in this case) the net subsystem would have to deal with = RCU quietness > before disposing of the slab cache. There may be multiple ways of dea= ling > with RCU. The RCU barrier may be unnecessary for future uses. Typical= ly > one would expect that all deferred handling of structures must be com= plete > for correctness before disposing of the whole cache. Point is we cannot deal with RCU quietness before disposing the slab ca= che, (if SLAB_DESTROY_BY_RCU was set on the cache) since this disposing *wil= l*=20 make call_rcu() calls when a full slab is freed/purged. And when RCU grace period is elapsed, the callback *will* need access t= o=20 the cache we want to dismantle. Better to not have kfreed()/poisoned it= =2E.. I believe you mix two RCU uses here. 1) The one we all know, is use normal caches (!SLAB_DESTROY_BY_RCU)=20 (or kmalloc()), and use call_rcu(... kfree_something) In this case, you are 100% right that the subsystem itself has to call rcu_barrier() (or respect whatever self-synchro) itself, before calling kmem_cache_destroy() 2) The SLAB_DESTROY_BY_RCU one. Part of cache dismantle needs to call rcu_barrier() itself. Caller doesnt have to use rcu_barrier(). It would be a waste of time= , as kmem_cache_destroy() will refill rcu wait queues with its own stu= ff.