From: Muchun Song <songmuchun@bytedance.com>
To: cl@linux.com, penberg@kernel.org, rientjes@google.com,
iamjoonsoo.kim@lge.com, akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Muchun Song <songmuchun@bytedance.com>
Subject: [PATCH 2/3] mm/slub: Use node_nr_slabs() instead of slabs_node()
Date: Sun, 14 Jun 2020 20:39:22 +0800 [thread overview]
Message-ID: <20200614123923.99189-3-songmuchun@bytedance.com> (raw)
In-Reply-To: <20200614123923.99189-1-songmuchun@bytedance.com>
In the some code, we already get the kmem_cache_node, so we can
use node_nr_slabs() directly instead of slabs_node(). Check the
condition of n->nr_partial can also be removed because we can get
the correct result via node_nr_slabs().
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
---
mm/slub.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/mm/slub.c b/mm/slub.c
index 1a3e6a5b7287..b73505df3de2 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -3829,7 +3829,7 @@ bool __kmem_cache_empty(struct kmem_cache *s)
struct kmem_cache_node *n;
for_each_kmem_cache_node(s, node, n)
- if (n->nr_partial || slabs_node(s, node))
+ if (node_nr_slabs(n))
return false;
return true;
}
@@ -3846,7 +3846,7 @@ int __kmem_cache_shutdown(struct kmem_cache *s)
/* Attempt to free all objects */
for_each_kmem_cache_node(s, node, n) {
free_partial(s, n);
- if (n->nr_partial || slabs_node(s, node))
+ if (node_nr_slabs(n))
return 1;
}
sysfs_slab_remove(s);
@@ -4126,7 +4126,7 @@ int __kmem_cache_shrink(struct kmem_cache *s)
list_for_each_entry_safe(page, t, &discard, slab_list)
discard_slab(s, page);
- if (slabs_node(s, node))
+ if (node_nr_slabs(n))
ret = 1;
}
@@ -4201,7 +4201,7 @@ static void slab_mem_offline_callback(void *arg)
* and offline_pages() function shouldn't call this
* callback. So, we must fail.
*/
- BUG_ON(slabs_node(s, offline_node));
+ BUG_ON(node_nr_slabs(n));
s->node[offline_node] = NULL;
kmem_cache_free(kmem_cache_node, n);
--
2.11.0
next prev parent reply other threads:[~2020-06-14 12:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-14 12:39 [PATCH 0/3] mm/slub: Fix slabs_node return value Muchun Song
2020-06-14 12:39 ` [PATCH 1/3] mm/slub: Fix slabs_node return value when CONFIG_SLUB_DEBUG disabled Muchun Song
2020-06-15 6:11 ` Joonsoo Kim
2020-06-15 6:26 ` [External] " Muchun Song
2020-06-15 16:46 ` Vlastimil Babka
2020-06-14 12:39 ` Muchun Song [this message]
2020-06-15 6:15 ` [PATCH 2/3] mm/slub: Use node_nr_slabs() instead of slabs_node() Joonsoo Kim
2020-06-15 6:20 ` [External] " Muchun Song
2020-06-14 12:39 ` [PATCH 3/3] mm/slub: Fix release all resources used by a slab cache Muchun Song
2020-06-15 6:23 ` Joonsoo Kim
2020-06-15 6:41 ` [External] " Muchun Song
2020-06-15 7:25 ` Joonsoo Kim
2020-06-15 7:50 ` Muchun Song
2020-06-17 16:19 ` [PATCH 0/3] mm/slub: Fix slabs_node return value Christopher Lameter
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=20200614123923.99189-3-songmuchun@bytedance.com \
--to=songmuchun@bytedance.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=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
all inboxes | Powered by JetHome®