File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -161,23 +161,25 @@ static void fill_pool(void)
161
161
return ;
162
162
163
163
while (READ_ONCE (obj_pool_free ) < debug_objects_pool_min_level ) {
164
- struct debug_obj * new [ODEBUG_BATCH_SIZE ];
164
+ struct debug_obj * new , * last = NULL ;
165
+ HLIST_HEAD (head );
165
166
int cnt ;
166
167
167
168
for (cnt = 0 ; cnt < ODEBUG_BATCH_SIZE ; cnt ++ ) {
168
- new [ cnt ] = kmem_cache_zalloc (obj_cache , gfp );
169
- if (!new [ cnt ] )
169
+ new = kmem_cache_zalloc (obj_cache , gfp );
170
+ if (!new )
170
171
break ;
172
+ hlist_add_head (& new -> node , & head );
173
+ if (!last )
174
+ last = new ;
171
175
}
172
176
if (!cnt )
173
177
return ;
174
178
175
179
raw_spin_lock_irqsave (& pool_lock , flags );
176
- while (cnt ) {
177
- hlist_add_head (& new [-- cnt ]-> node , & obj_pool );
178
- debug_objects_allocated ++ ;
179
- WRITE_ONCE (obj_pool_free , obj_pool_free + 1 );
180
- }
180
+ hlist_splice_init (& head , & last -> node , & obj_pool );
181
+ debug_objects_allocated += cnt ;
182
+ WRITE_ONCE (obj_pool_free , obj_pool_free + cnt );
181
183
raw_spin_unlock_irqrestore (& pool_lock , flags );
182
184
}
183
185
}
You can’t perform that action at this time.
0 commit comments