Skip to content

Commit b3d8a8e

Browse files
jianfenwtehcaster
authored andcommitted
slub: use count_partial_free_approx() in slab_out_of_memory()
slab_out_of_memory() uses count_partial() to get the exact count of free objects for each node. As it may get called in the slab allocation path, count_partial_free_approx() can be used to avoid the risk and overhead of traversing a long partial slab list. At the same time, show_slab_objects() still uses count_partial(). Thus, slub users can still have the option to access the exact count of objects via sysfs if the overhead is acceptable to them. Signed-off-by: Jianfeng Wang <[email protected]> Acked-by: David Rientjes <[email protected]> Signed-off-by: Vlastimil Babka <[email protected]>
1 parent 046f4c6 commit b3d8a8e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mm/slub.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3301,7 +3301,7 @@ slab_out_of_memory(struct kmem_cache *s, gfp_t gfpflags, int nid)
33013301
unsigned long nr_objs;
33023302
unsigned long nr_free;
33033303

3304-
nr_free = count_partial(n, count_free);
3304+
nr_free = count_partial_free_approx(n);
33053305
nr_slabs = node_nr_slabs(n);
33063306
nr_objs = node_nr_objs(n);
33073307

0 commit comments

Comments
 (0)