Skip to content

Commit 51f271c

Browse files
Kemeng Shiakpm00
authored andcommitted
mm: swap: add back full cluster when no entry is reclaimed
If no swap cache is reclaimed, cluster taken off from full_clusters list will not be put in any list and we can't reclaime HAS_CACHE slots efficiently. Do relocate_cluster for such cluster to avoid inefficiency. Link: https://lkml.kernel.org/r/20250224113910.522439-1-shikemeng@huaweicloud.com Fixes: 3b64477 ("mm, swap: reduce contention on device lock") Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com> Reviewed-by: Kairui Song <kasong@tencent.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 47b16d0 commit 51f271c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

mm/swapfile.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -858,6 +858,10 @@ static void swap_reclaim_full_clusters(struct swap_info_struct *si, bool force)
858858
offset++;
859859
}
860860

861+
/* in case no swap cache is reclaimed */
862+
if (ci->flags == CLUSTER_FLAG_NONE)
863+
relocate_cluster(si, ci);
864+
861865
unlock_cluster(ci);
862866
if (to_scan <= 0)
863867
break;

0 commit comments

Comments
 (0)