summaryrefslogtreecommitdiff
path: root/mm/slub.c
diff options
context:
space:
mode:
authorVlastimil Babka <vbabka@suse.cz>2021-05-20 14:18:12 +0200
committerVlastimil Babka <vbabka@suse.cz>2021-09-04 01:12:22 +0200
commitc2f973ba42ed1fe7b2ca71e93767afeacc88caa0 (patch)
treeba1b54cbb661f42a88876fb91812774ac154b1f8 /mm/slub.c
parent8de06a6f48f2062444a8872eb7f5abbfe65b5ecd (diff)
downloadlwn-c2f973ba42ed1fe7b2ca71e93767afeacc88caa0.tar.gz
lwn-c2f973ba42ed1fe7b2ca71e93767afeacc88caa0.zip
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 <vbabka@suse.cz>
Diffstat (limited to 'mm/slub.c')
-rw-r--r--mm/slub.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/mm/slub.c b/mm/slub.c
index 0a1e048d0db7..b31e00eb9561 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2358,16 +2358,20 @@ static void unfreeze_partials(struct kmem_cache *s,
{
#ifdef CONFIG_SLUB_CPU_PARTIAL
struct kmem_cache_node *n = NULL, *n2 = NULL;
- struct page *page, *discard_page = NULL;
+ struct page *page, *partial_page, *discard_page = NULL;
unsigned long flags;
local_irq_save(flags);
- while ((page = slub_percpu_partial(c))) {
+ partial_page = slub_percpu_partial(c);
+ c->partial = NULL;
+
+ while (partial_page) {
struct page new;
struct page old;
- slub_set_percpu_partial(c, page);
+ page = partial_page;
+ partial_page = page->next;
n2 = get_node(s, page_to_nid(page));
if (n != n2) {