mm/slub: simplify get_partial_node()
authorXiongwei Song <xiongwei.song@windriver.com>
Thu, 4 Apr 2024 05:58:26 +0000 (13:58 +0800)
committerVlastimil Babka <vbabka@suse.cz>
Thu, 4 Apr 2024 09:29:26 +0000 (11:29 +0200)
commitff99b18fee793826dd5604da72d6259a531b45e9
treefdcbfa4e5d0015161ce4709ea2ffe435736086d7
parent721a2f8be134f9bb61f4358cbb7ae394eaf74573
mm/slub: simplify get_partial_node()

The break conditions for filling cpu partial can be more readable and
simple.

If slub_get_cpu_partial() returns 0, we can confirm that we don't need
to fill cpu partial, then we should break from the loop. On the other
hand, we also should break from the loop if we have added enough cpu
partial slabs.

Meanwhile, the logic above gets rid of the #ifdef and also fixes a weird
corner case that if we set cpu_partial_slabs to 0 from sysfs, we still
allocate at least one here.

Signed-off-by: Xiongwei Song <xiongwei.song@windriver.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
mm/slub.c