Skip to content

Commit 721a2f8

Browse files
Xiongwei Songtehcaster
authored andcommitted
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 <[email protected]> Signed-off-by: Vlastimil Babka <[email protected]>
1 parent acc8f4d commit 721a2f8

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

mm/slub.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,11 +604,21 @@ static void slub_set_cpu_partial(struct kmem_cache *s, unsigned int nr_objects)
604604
nr_slabs = DIV_ROUND_UP(nr_objects * 2, oo_objects(s->oo));
605605
s->cpu_partial_slabs = nr_slabs;
606606
}
607+
608+
static inline unsigned int slub_get_cpu_partial(struct kmem_cache *s)
609+
{
610+
return s->cpu_partial_slabs;
611+
}
607612
#else
608613
static inline void
609614
slub_set_cpu_partial(struct kmem_cache *s, unsigned int nr_objects)
610615
{
611616
}
617+
618+
static inline unsigned int slub_get_cpu_partial(struct kmem_cache *s)
619+
{
620+
return 0;
621+
}
612622
#endif /* CONFIG_SLUB_CPU_PARTIAL */
613623

614624
/*

0 commit comments

Comments
 (0)