mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-07 13:43:51 +00:00
mm/slub: add slub_get_cpu_partial() helper
Add slub_get_cpu_partial() and dummy function to help improve get_partial_node(). It can help remove #ifdef of CONFIG_SLUB_CPU_PARTIAL and improve filling cpu partial logic. Signed-off-by: Xiongwei Song <xiongwei.song@windriver.com> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
This commit is contained in:
parent
acc8f4dbf1
commit
721a2f8be1
10
mm/slub.c
10
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));
|
nr_slabs = DIV_ROUND_UP(nr_objects * 2, oo_objects(s->oo));
|
||||||
s->cpu_partial_slabs = nr_slabs;
|
s->cpu_partial_slabs = nr_slabs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline unsigned int slub_get_cpu_partial(struct kmem_cache *s)
|
||||||
|
{
|
||||||
|
return s->cpu_partial_slabs;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
static inline void
|
static inline void
|
||||||
slub_set_cpu_partial(struct kmem_cache *s, unsigned int nr_objects)
|
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 */
|
#endif /* CONFIG_SLUB_CPU_PARTIAL */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user