History

debugobjects: Fix conditions in fill_pool()

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 ]

Zhen Lei committed 2 years ago

Commit 684d28f1 parent e4757c71 file · +3 −2Browse files

Showing the changes to lib/debugobjects.c (1 of 1 file). Show all

Unified · Split

lib/debugobjects.c+3−2
@@ -142,13 +142,14 @@ static void fill_pool(void) · 141 unmodified lines
142 * READ_ONCE()s pair with the WRITE_ONCE()s in pool_lock critical142 * READ_ONCE()s pair with the WRITE_ONCE()s in pool_lock critical
143 * sections.143 * sections.
144 */144 */
145 while (READ_ONCE(obj_nr_tofree) && (READ_ONCE(obj_pool_free) < obj_pool_min_free)) {145 while (READ_ONCE(obj_nr_tofree) &&
146 READ_ONCE(obj_pool_free) < debug_objects_pool_min_level) {
146 raw_spin_lock_irqsave(&pool_lock, flags);147 raw_spin_lock_irqsave(&pool_lock, flags);
147 /*148 /*
148 * Recheck with the lock held as the worker thread might have149 * Recheck with the lock held as the worker thread might have
149 * won the race and freed the global free list already.150 * won the race and freed the global free list already.
150 */151 */
151 while (obj_nr_tofree && (obj_pool_free < obj_pool_min_free)) {152 while (obj_nr_tofree && (obj_pool_free < debug_objects_pool_min_level)) {
152 obj = hlist_entry(obj_to_free.first, typeof(*obj), node);153 obj = hlist_entry(obj_to_free.first, typeof(*obj), node);
153 hlist_del(&obj->node);154 hlist_del(&obj->node);
154 WRITE_ONCE(obj_nr_tofree, obj_nr_tofree - 1);155 WRITE_ONCE(obj_nr_tofree, obj_nr_tofree - 1);