[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200614123923.99189-3-songmuchun@bytedance.com>
Date: Sun, 14 Jun 2020 20:39:22 +0800
From: Muchun Song <songmuchun@...edance.com>
To: cl@...ux.com, penberg@...nel.org, rientjes@...gle.com,
iamjoonsoo.kim@....com, akpm@...ux-foundation.org
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Muchun Song <songmuchun@...edance.com>
Subject: [PATCH 2/3] mm/slub: Use node_nr_slabs() instead of slabs_node()
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@...edance.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
Powered by blists - more mailing lists