v1
2026-08-07
休眠 swap 槽不进入 swap cache · v1
修复集群预读把 hibernation 槽当普通 swap 槽使用导致释放错乱,为 hibernation 槽引入独立类型。
原始补丁链接
子 Patch(4)
1/4
mm, swap: don't free a hibernation slot that is in the swap cache
A slot with a folio in the swap cache is freed when the folio leaves the cache, not when its count drops. swap_put_entries_cluster() follows that rule. swap_free_hibernation_slot() does not, it call
2/4
mm, swap: give hibernation swap slots their own swap table entry type
swap_alloc_hibernation_slot() stores a fake shadow in the slot it hands out. An anon slot swapped out with no workingset shadow looks exactly the same, so nothing in mm can tell the two apart. Give
3/4
mm, swap: only allow swapped-out slots into the swap cache
__swap_cache_add_check() turns away folio entries and slots with no count and lets everything else in. That is safe only when the caller owns the slot. Cluster readahead owns nothing, it walks a raw
4/4
mm, swap: drop the swap cache guard and reclaim in swap_free_hibernation_slot()
Both are there for a folio that readahead might have put on the slot. The previous patch turns these slots away at the swap cache boundary, so no such folio can exist. Signed-off-by: Youngjun Park <