public inbox for linux-mm@kvack.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] mm/swap: enhance swap cluster allocation checks
@ 2026-03-09  8:05 Hui Zhu
  2026-03-09  8:05 ` [PATCH v2 1/2] mm/swap: Add VM_WARN_ON to isolate_lock_cluster() Hui Zhu
  2026-03-09  8:05 ` [PATCH v2 2/2] mm/swap: Add lockdep for si->global_cluster_lock in swap_cluster_alloc_table() Hui Zhu
  0 siblings, 2 replies; 6+ messages in thread
From: Hui Zhu @ 2026-03-09  8:05 UTC (permalink / raw)
  To: Andrew Morton, Chris Li, Kairui Song, Kemeng Shi, Nhat Pham,
	Baoquan He, Barry Song, YoungJun Park, linux-mm, linux-kernel
  Cc: Hui Zhu

From: Hui Zhu <zhuhui@kylinos.cn>

This series enhances safety and debugging for swap cluster allocation
paths in mm/swapfile.c.

Patch 1 adds a VM_WARN_ON in isolate_lock_cluster() to verify that
full clusters (which should already have allocated tables) are not
processed by swap_cluster_alloc_table().

Patch 2 adds lockdep_assert_held for si->global_cluster_lock on non-SSD
devices and adjusts the assertion order to match the actual lock
acquisition sequence.

Changelog:
v2:
According to the comments of YoungJun Park, Kairui Song and Chris Li,
change acquire locks in swap_reclaim_work() to adds a VM_WARN_ON in
isolate_lock_cluster().
According to the comments of YoungJun Park, add code in patch 2 to Change
the order of lockdep_assert_held() to match the actual lock acquisition
order.

Hui Zhu (2):
  mm/swap: Add VM_WARN_ON to isolate_lock_cluster()
  mm/swap: Add lockdep for si->global_cluster_lock in
    swap_cluster_alloc_table()

 mm/swapfile.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

-- 
2.43.0



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-03-09 13:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-09  8:05 [PATCH v2 0/2] mm/swap: enhance swap cluster allocation checks Hui Zhu
2026-03-09  8:05 ` [PATCH v2 1/2] mm/swap: Add VM_WARN_ON to isolate_lock_cluster() Hui Zhu
2026-03-09  8:46   ` YoungJun Park
2026-03-09 13:23   ` Kairui Song
2026-03-09  8:05 ` [PATCH v2 2/2] mm/swap: Add lockdep for si->global_cluster_lock in swap_cluster_alloc_table() Hui Zhu
2026-03-09  8:41   ` YoungJun Park

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox