v4
2026-10-30
热插拔分配器竞态修复 · v4
修复 zonelist 重建期间 page_alloc/hugetlb/mempolicy 遍历竞态;作者暂缓合入,待与另一组修复合并重发。
原始补丁链接
子 Patch(8)
1/8
mm/page_alloc: reset can_retry_reserves when the slowpath restarts
slowpath 因 cpuset/zonelist 变化重启时重置 can_retry_reserves,使 GFP_NOWAIT|__GFP_MEMALLOC 等无回收调用仍能再尝试一次带 reserve_flags 分配,避免漏用保留页。
2/8
mm/page_alloc: detect zonelist rebuilds from memory hot-add
将 zonelist_update_seq 重试从 CONFIG_MEMORY_HOTREMOVE 扩到 MEMORY_HOTPLUG;内存热添加 onlining 首个 zone 块会原地重写 zonelist,__GFP_THISNODE 可能见中间态而误失败。
3/8
mm/page_alloc: snapshot the preferred zone against shrink rebuilds
get_page_from_freelist()/alloc_pages_bulk_noprof() 只读取一次 ac->preferred_zoneref->zone,避免 zone 离线重建 zonelist 时槽位变 NULL 导致 page_statistics() 空指针;zone 不释放故 stale 安全。
4/8
mm/mmzone: read each zoneref slot once when filtering by nodemask
__next_zones_zonelist() tests a slot’s zone for NULL, then reads the slot again to look up the zone’s node. Offlining a zone’s last block rebuilds the zonelists in place, so the second read can return
5/8
mm/page_alloc: retry allocations that raced with a zonelist rebuild
Onlining the first block of a zone rebuilds every zonelist in place, shifting the slots after the new zone. The iterator approves a slot, then the allocator loads the zone from it, so a GFP_KERNEL re
6/8
mm/hugetlb: retry the pool walk when the zonelist is rebuilt
Onlining the first block of a zone rebuilds every zonelist in place, shifting the slots after the new zone. dequeue_hugetlb_folio_nodemask() approves a slot by its node, then loads the zone from it,
7/8
mm/page_alloc: retry alloc_contig_pages() when the zonelist is rebuilt
Onlining the first block of a zone rebuilds every zonelist in place, shifting the slots after the new zone. alloc_contig_frozen_pages_noprof() approves a slot by the caller’s gfp and nodemask, then lo
8/8
mm/mempolicy: read the zoneref slot once in mempolicy_slab_node()
For a bind or preferred-many policy, mempolicy_slab_node() tests the first matching slot’s zone for NULL, then reads the slot again to look up the zone’s node. Offlining a zone’s last block rebuilds t