[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.10.1701171452580.142998@chino.kir.corp.google.com>
Date: Tue, 17 Jan 2017 14:54:42 -0800 (PST)
From: David Rientjes <rientjes@...gle.com>
To: kwon <kwon@...nyone.net>
cc: Joonsoo Kim <iamjoonsoo.kim@....com>,
Christoph Lameter <cl@...ux.com>,
Pekka Enberg <penberg@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] slab: add a check for the first kmem_cache not to be
destroyed
On Tue, 17 Jan 2017, kwon wrote:
> >> diff --git a/mm/slab_common.c b/mm/slab_common.c
> >> index 1dfc209..2d30ace 100644
> >> --- a/mm/slab_common.c
> >> +++ b/mm/slab_common.c
> >> @@ -744,7 +744,7 @@ void kmem_cache_destroy(struct kmem_cache *s)
> >> bool need_rcu_barrier = false;
> >> int err;
> >>
> >> - if (unlikely(!s))
> >> + if (unlikely(!s) || s->refcount == -1)
> >> return;
> >
> > Hello, Kyunghwan.
> >
> > Few lines below, s->refcount is checked.
> >
> > if (s->refcount)
> > goto unlock;
> >
> > Am I missing something?
> >
> > Thanks.
>
> Hello, Joonsoo.
>
> In case it is called the number of int size times. refcount would finally reach
> to 0 since decreased every time the function called.
>
The only thing using create_boot_cache() should be the slab implementation
itself, so I don't think we need to protect ourselves from doing something
like kmem_cache_destroy(kmem_cache) or
kmem_cache_destroy(kmem_cache_node) even a single time.
Powered by blists - more mailing lists