[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZnBwOf3faUJMbrfW@pc636>
Date: Mon, 17 Jun 2024 19:19:53 +0200
From: Uladzislau Rezki <urezki@...il.com>
To: "Jason A. Donenfeld" <Jason@...c4.com>
Cc: Uladzislau Rezki <urezki@...il.com>,
"Paul E. McKenney" <paulmck@...nel.org>,
Vlastimil Babka <vbabka@...e.cz>, Jakub Kicinski <kuba@...nel.org>,
Julia Lawall <Julia.Lawall@...ia.fr>, linux-block@...r.kernel.org,
kernel-janitors@...r.kernel.org, bridge@...ts.linux.dev,
linux-trace-kernel@...r.kernel.org,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
kvm@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
"Naveen N. Rao" <naveen.n.rao@...ux.ibm.com>,
Christophe Leroy <christophe.leroy@...roup.eu>,
Nicholas Piggin <npiggin@...il.com>, netdev@...r.kernel.org,
wireguard@...ts.zx2c4.com, linux-kernel@...r.kernel.org,
ecryptfs@...r.kernel.org, Neil Brown <neilb@...e.de>,
Olga Kornievskaia <kolga@...app.com>, Dai Ngo <Dai.Ngo@...cle.com>,
Tom Talpey <tom@...pey.com>, linux-nfs@...r.kernel.org,
linux-can@...r.kernel.org, Lai Jiangshan <jiangshanlai@...il.com>,
netfilter-devel@...r.kernel.org, coreteam@...filter.org
Subject: Re: [PATCH 00/14] replace call_rcu by kfree_rcu for simple
kmem_cache_free callback
On Mon, Jun 17, 2024 at 06:57:45PM +0200, Jason A. Donenfeld wrote:
> On Mon, Jun 17, 2024 at 06:42:23PM +0200, Uladzislau Rezki wrote:
> > On Mon, Jun 17, 2024 at 06:33:23PM +0200, Jason A. Donenfeld wrote:
> > > On Mon, Jun 17, 2024 at 6:30 PM Uladzislau Rezki <urezki@...il.com> wrote:
> > > > Here if an "err" is less then "0" means there are still objects
> > > > whereas "is_destroyed" is set to "true" which is not correlated
> > > > with a comment:
> > > >
> > > > "Destruction happens when no objects"
> > >
> > > The comment is just poorly written. But the logic of the code is right.
> > >
> > OK.
> >
> > > >
> > > > > out_unlock:
> > > > > mutex_unlock(&slab_mutex);
> > > > > cpus_read_unlock();
> > > > > diff --git a/mm/slub.c b/mm/slub.c
> > > > > index 1373ac365a46..7db8fe90a323 100644
> > > > > --- a/mm/slub.c
> > > > > +++ b/mm/slub.c
> > > > > @@ -4510,6 +4510,8 @@ void kmem_cache_free(struct kmem_cache *s, void *x)
> > > > > return;
> > > > > trace_kmem_cache_free(_RET_IP_, x, s);
> > > > > slab_free(s, virt_to_slab(x), x, _RET_IP_);
> > > > > + if (s->is_destroyed)
> > > > > + kmem_cache_destroy(s);
> > >
> > Here i am not follow you. How do you see that a cache has been fully
> > freed? Or is it just super draft code?
>
> kmem_cache_destroy() does this in shutdown_cache().
>
Right. In this scenario you invoke kmem_cache_destroy() over and over
until the last object gets freed. This potentially slowing the kmem_cache_free()
which is not OK, at least to me.
--
Uladzislau Rezki
Powered by blists - more mailing lists