[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240331021926.2732572-3-xiongwei.song@windriver.com>
Date: Sun, 31 Mar 2024 10:19:24 +0800
From: <xiongwei.song@...driver.com>
To: <vbabka@...e.cz>, <rientjes@...gle.com>, <cl@...ux.com>,
<penberg@...nel.org>, <iamjoonsoo.kim@....com>,
<akpm@...ux-foundation.org>, <roman.gushchin@...ux.dev>,
<42.hyeyoo@...il.com>
CC: <linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>,
<chengming.zhou@...ux.dev>
Subject: [PATCH 2/4] mm/slub: add slub_get_cpu_partial() helper
From: Xiongwei Song <xiongwei.song@...driver.com>
Add slub_get_cpu_partial() and dummy function to help improve
get_partial_node(). It can prevent compile error when accessing
cpu_partial_slabs with CONFIG_SLUB_CPU_PARTIAL disabled.
Signed-off-by: Xiongwei Song <xiongwei.song@...driver.com>
---
mm/slub.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/mm/slub.c b/mm/slub.c
index 059922044a4f..590cc953895d 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -604,11 +604,21 @@ static void slub_set_cpu_partial(struct kmem_cache *s, unsigned int nr_objects)
nr_slabs = DIV_ROUND_UP(nr_objects * 2, oo_objects(s->oo));
s->cpu_partial_slabs = nr_slabs;
}
+
+static inline unsigned int slub_get_cpu_partial(struct kmem_cache *s)
+{
+ return s->cpu_partial_slabs;
+}
#else
static inline void
slub_set_cpu_partial(struct kmem_cache *s, unsigned int nr_objects)
{
}
+
+static inline unsigned int slub_get_cpu_partial(struct kmem_cache *s)
+{
+ return 0;
+}
#endif /* CONFIG_SLUB_CPU_PARTIAL */
/*
--
2.27.0
Powered by blists - more mailing lists