linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: kwon <kwon@toanyone.net>
To: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	Christoph Lameter <cl@linux.com>,
	Pekka Enberg <penberg@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] slab: add a check for the first kmem_cache not to be destroyed
Date: Wed, 18 Jan 2017 11:36:15 +0900	[thread overview]
Message-ID: <380AA0F8-58C6-4AC7-AE06-D3A326E5B396@toanyone.net> (raw)
In-Reply-To: <alpine.DEB.2.10.1701171452580.142998@chino.kir.corp.google.com>


> On Jan 18, 2017, at 7:54 AM, David Rientjes <rientjes@google.com> wrote:
> 
> 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.

Agreed. I was aware of that though, I thought it would make its logic firm not
giving performance disadvantages. Sorry for distraction.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

      reply	other threads:[~2017-01-18  2:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-16  7:04 Kyunghwan Kwon
2017-01-17  1:33 ` Joonsoo Kim
2017-01-17  3:32   ` kwon
2017-01-17 22:54     ` David Rientjes
2017-01-18  2:36       ` kwon [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=380AA0F8-58C6-4AC7-AE06-D3A326E5B396@toanyone.net \
    --to=kwon@toanyone.net \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox