summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorKemeng Shi <shikemeng@huaweicloud.com>2025-02-24 19:39:10 +0800
committerAndrew Morton <akpm@linux-foundation.org>2025-03-05 21:36:15 -0800
commit51f271c1940fc9a5f77931ec603b457ea293bd56 (patch)
treeac46f6e60e59c5cea0dfef1f1817dd79251d4b20 /mm
parent47b16d0462a460000b8f05dfb1292377ac48f3ca (diff)
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: 3b644773eefd ("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>
Diffstat (limited to 'mm')
-rw-r--r--mm/swapfile.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/mm/swapfile.c b/mm/swapfile.c
index fab99d67026a..a6c41c7ffb03 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -858,6 +858,10 @@ static void swap_reclaim_full_clusters(struct swap_info_struct *si, bool force)
offset++;
}
+ /* in case no swap cache is reclaimed */
+ if (ci->flags == CLUSTER_FLAG_NONE)
+ relocate_cluster(si, ci);
+
unlock_cluster(ci);
if (to_scan <= 0)
break;