From: David Rientjes <rientjes@google.com>
To: Shakeel Butt <shakeelb@google.com>
Cc: "Jason A . Donenfeld" <Jason@zx2c4.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Christoph Lameter <cl@linux.com>,
Pekka Enberg <penberg@kernel.org>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>,
Andrew Morton <akpm@linux-foundation.org>,
stable@vger.kernel.org
Subject: Re: [PATCH] slub: fix __kmem_cache_empty for !CONFIG_SLUB_DEBUG
Date: Tue, 19 Jun 2018 17:49:44 -0700 (PDT) [thread overview]
Message-ID: <alpine.DEB.2.21.1806191748040.25812@chino.kir.corp.google.com> (raw)
In-Reply-To: <20180619213352.71740-1-shakeelb@google.com>
On Tue, 19 Jun 2018, Shakeel Butt wrote:
> diff --git a/mm/slub.c b/mm/slub.c
> index a3b8467c14af..731c02b371ae 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -3673,9 +3673,23 @@ static void free_partial(struct kmem_cache *s, struct kmem_cache_node *n)
>
> bool __kmem_cache_empty(struct kmem_cache *s)
> {
> - int node;
> + int cpu, node;
Nit: wouldn't cpu be unused if CONFIG_SLUB_DEBUG is disabled?
> struct kmem_cache_node *n;
>
> + /*
> + * slabs_node will always be 0 for !CONFIG_SLUB_DEBUG. So, manually
> + * check slabs for all cpus.
> + */
> + if (!IS_ENABLED(CONFIG_SLUB_DEBUG)) {
> + for_each_online_cpu(cpu) {
> + struct kmem_cache_cpu *c;
> +
> + c = per_cpu_ptr(s->cpu_slab, cpu);
> + if (c->page || slub_percpu_partial(c))
> + return false;
> + }
> + }
> +
> for_each_kmem_cache_node(s, node, n)
> if (n->nr_partial || slabs_node(s, node))
> return false;
Wouldn't it just be better to allow {inc,dec}_slabs_node() to adjust the
nr_slabs counter instead of doing the per-cpu iteration on every shutdown?
next prev parent reply other threads:[~2018-06-20 0:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-19 21:33 Shakeel Butt
2018-06-19 21:38 ` Shakeel Butt
2018-06-19 21:53 ` Jason A. Donenfeld
2018-06-19 22:21 ` Andrew Morton
2018-06-20 0:49 ` David Rientjes [this message]
2018-06-20 1:24 ` Shakeel Butt
2018-06-20 12:09 ` Andrey Ryabinin
2018-06-20 21:36 ` Shakeel Butt
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=alpine.DEB.2.21.1806191748040.25812@chino.kir.corp.google.com \
--to=rientjes@google.com \
--cc=Jason@zx2c4.com \
--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=shakeelb@google.com \
--cc=stable@vger.kernel.org \
/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