diff options
Diffstat (limited to 'lib/debugobjects.c')
| -rw-r--r-- | lib/debugobjects.c | 18 | 
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/debugobjects.c b/lib/debugobjects.c index df48acc5d4b3..798ce5ac1ffe 100644 --- a/lib/debugobjects.c +++ b/lib/debugobjects.c @@ -161,23 +161,25 @@ static void fill_pool(void)  		return;  	while (READ_ONCE(obj_pool_free) < debug_objects_pool_min_level) { -		struct debug_obj *new[ODEBUG_BATCH_SIZE]; +		struct debug_obj *new, *last = NULL; +		HLIST_HEAD(head);  		int cnt;  		for (cnt = 0; cnt < ODEBUG_BATCH_SIZE; cnt++) { -			new[cnt] = kmem_cache_zalloc(obj_cache, gfp); -			if (!new[cnt]) +			new = kmem_cache_zalloc(obj_cache, gfp); +			if (!new)  				break; +			hlist_add_head(&new->node, &head); +			if (!last) +				last = new;  		}  		if (!cnt)  			return;  		raw_spin_lock_irqsave(&pool_lock, flags); -		while (cnt) { -			hlist_add_head(&new[--cnt]->node, &obj_pool); -			debug_objects_allocated++; -			WRITE_ONCE(obj_pool_free, obj_pool_free + 1); -		} +		hlist_splice_init(&head, &last->node, &obj_pool); +		debug_objects_allocated += cnt; +		WRITE_ONCE(obj_pool_free, obj_pool_free + cnt);  		raw_spin_unlock_irqrestore(&pool_lock, flags);  	}  }  | 
