v1
2026-07-20
swap随机修复与清理 · v1
修复 swap 中潜在的空指针解引用,调整 setup_swap_clusters_info() 初始化顺序,并清理 swap_extend_table_try_free()。
原始补丁链接
子 Patch(4)
1/4
mm, swap: Fix potential NULL dereference when trying a sleep table allocation
The root cause of this issue is because multi-tables are updated in non atomic context. To be more specific, the issue could be triggerred as following: swap_alloc_fast swap_cluster_populate(
2/4
mm, swap: Move setup_swap_clusters_info() after SWP_SOLIDSTATE initialization
In setup_swap_clusters_info(), SWP_SOLIDSTATE is used to decide global_cluster allocation. Move setup_swap_clusters_info() after SWP_SOLIDSTATE initialization to avoid unneeded global_cluster allocati
3/4
mm, swap: return early from swap_extend_table_try_free() on first non-zero entry
Return immediately when the first non-zero swap count is found as any non-zero swap count prevents freeing extend_table and further iteration is pointless. Signed-off-by: Kemeng Shi <shikemeng@huawei
4/4
mm, swap: Remove unneeded swap_extend_table_try_free() in swap_dup_entries_cluster()
Since commit 0475fde0f68de (“mm, swap: avoid leaving unused extend table after alloc race”), extend table is always allocated when any swap count reach MAX - 1 and is always freed when swap count decr