diff options
| author | Zhen Lei <thunder.leizhen@huawei.com> | 2024-09-04 21:39:40 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-10-17 15:11:14 +0200 |
| commit | 21f055191ea50a7384ba7b53f300e5db93891c86 (patch) | |
| tree | 69161c9c672e29106a9adc1a2e28d701b2e30b6f /lib | |
| parent | f5056adc042f6e67cb8d88092c4c3a3ec9a63b03 (diff) | |
| download | linux-21f055191ea50a7384ba7b53f300e5db93891c86.tar.gz linux-21f055191ea50a7384ba7b53f300e5db93891c86.tar.bz2 linux-21f055191ea50a7384ba7b53f300e5db93891c86.zip | |
debugobjects: Fix conditions in fill_pool()
commit 684d28feb8546d1e9597aa363c3bfcf52fe250b7 upstream.
fill_pool() uses 'obj_pool_min_free' to decide whether objects should be
handed back to the kmem cache. But 'obj_pool_min_free' records the lowest
historical value of the number of objects in the object pool and not the
minimum number of objects which should be kept in the pool.
Use 'debug_objects_pool_min_level' instead, which holds the minimum number
which was scaled to the number of CPUs at boot time.
[ tglx: Massage change log ]
Fixes: d26bf5056fc0 ("debugobjects: Reduce number of pool_lock acquisitions in fill_pool()")
Fixes: 36c4ead6f6df ("debugobjects: Add global free list and the counter")
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/all/20240904133944.2124-3-thunder.leizhen@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/debugobjects.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/debugobjects.c b/lib/debugobjects.c index 3972e2123e55..0b0449ee21aa 100644 --- a/lib/debugobjects.c +++ b/lib/debugobjects.c @@ -144,13 +144,14 @@ static void fill_pool(void) * READ_ONCE()s pair with the WRITE_ONCE()s in pool_lock critical * sections. */ - while (READ_ONCE(obj_nr_tofree) && (READ_ONCE(obj_pool_free) < obj_pool_min_free)) { + while (READ_ONCE(obj_nr_tofree) && + READ_ONCE(obj_pool_free) < debug_objects_pool_min_level) { raw_spin_lock_irqsave(&pool_lock, flags); /* * Recheck with the lock held as the worker thread might have * won the race and freed the global free list already. */ - while (obj_nr_tofree && (obj_pool_free < obj_pool_min_free)) { + while (obj_nr_tofree && (obj_pool_free < debug_objects_pool_min_level)) { obj = hlist_entry(obj_to_free.first, typeof(*obj), node); hlist_del(&obj->node); WRITE_ONCE(obj_nr_tofree, obj_nr_tofree - 1); |
