slub: use count_partial_free_approx() in slab_out_of_memory()
authorJianfeng Wang <jianfeng.w.wang@oracle.com>
Tue, 23 Apr 2024 04:55:54 +0000 (21:55 -0700)
committerVlastimil Babka <vbabka@suse.cz>
Tue, 23 Apr 2024 11:18:39 +0000 (13:18 +0200)
commitb3d8a8e870144369fdbcbb1a78878ce98532265a
tree44c289e625ff9cbc510a695b90bedcb0f6253906
parent046f4c69090c120a51aa4767628afa900aac8e28
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 <jianfeng.w.wang@oracle.com>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
mm/slub.c