summaryrefslogtreecommitdiff
path: root/include/linux/patchkey.h
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2026-10-31 22:13:30 -0400
committerVlastimil Babka (SUSE) <vbabka@kernel.org>2026-11-05 10:57:10 +0100
commit7bfcf81b1cb469bc016fa8e07939c0924b9ff8db (patch)
tree7ba7541f11ea76dec0f5e2ad039405b5bce5a8ff /include/linux/patchkey.h
parentb35ce030893929b3670de82bdac2713cb7b20d90 (diff)
mm/page_alloc: keep the pagesets of an empty zone
When the last memory of a zone goes offline, zone_pcp_reset() frees zone->per_cpu_pageset and zone->per_cpu_zonestats. Nothing waits for those who found the zone populated and still use the two pointers. They take neither the memory hotplug lock nor any other lock which offline_pages() holds, and some of them can sleep: CPU0 vmstat_update() CPU1 offline_pages() refresh_cpu_vm_stats() for_each_populated_zone(zone) pcp = zone->per_cpu_pageset cond_resched() adjust_present_page_count() zone_pcp_reset(zone) free_percpu(zone->per_cpu_pageset) decay_pcp_high(zone, pcp) __this_cpu_write(pcp->expire, 0) The same goes for drain_all_pages(NULL), which takes pcp->lock, for zone_pcp_update(), show_free_areas() and the readers and writers of the zonestats. If the per-cpu memory has got a new owner in the meantime, it is corrupted. The pagesets are only freed because setup_zone_pageset() would otherwise leak them when the zone gets memory again. Keep them instead and let setup_zone_pageset() and zone_pcp_init() use them again, like it is done with pgdat->per_cpu_nodestats. Their lists are empty, and their limits have been calculated for a zone without memory by the init_per_zone_wmark_min() of offline_pages(), which is what setup_zone_pageset() would come up with as well. Fixes: 340175b7d14d ("mm/hotplug: free zone->pageset when a zone becomes empty") Cc: stable@vger.kernel.org Assisted-by: LLM Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: David Hildenbrand (Arm) <david@kernel.org> Reviewed-by: Johannes Weiner <hannes@cmpxchg.org> Signed-off-by: Gregory Price (Meta) <gourry@gourry.net> Link: https://patch.msgid.link/20261101021340.2251928-3-gourry@gourry.net Reviewed-by: Zi Yan <ziy@nvidia.com> Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Diffstat (limited to 'include/linux/patchkey.h')
0 files changed, 0 insertions, 0 deletions