Skip to content

Commit c2f973b

Browse files
committed
mm, slub: detach whole partial list at once in unfreeze_partials()
Instead of iterating through the live percpu partial list, detach it from the kmem_cache_cpu at once. This is simpler and will allow further optimization. Signed-off-by: Vlastimil Babka <[email protected]>
1 parent 8de06a6 commit c2f973b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

mm/slub.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2358,16 +2358,20 @@ static void unfreeze_partials(struct kmem_cache *s,
23582358
{
23592359
#ifdef CONFIG_SLUB_CPU_PARTIAL
23602360
struct kmem_cache_node *n = NULL, *n2 = NULL;
2361-
struct page *page, *discard_page = NULL;
2361+
struct page *page, *partial_page, *discard_page = NULL;
23622362
unsigned long flags;
23632363

23642364
local_irq_save(flags);
23652365

2366-
while ((page = slub_percpu_partial(c))) {
2366+
partial_page = slub_percpu_partial(c);
2367+
c->partial = NULL;
2368+
2369+
while (partial_page) {
23672370
struct page new;
23682371
struct page old;
23692372

2370-
slub_set_percpu_partial(c, page);
2373+
page = partial_page;
2374+
partial_page = page->next;
23712375

23722376
n2 = get_node(s, page_to_nid(page));
23732377
if (n != n2) {

0 commit comments

Comments
 (0)