mm-swap-fix-swap-cache-index-error-when-retrying-reclaim.patch removed from -mm tree
The quilt patch titled
Subject: mm, swap: fix swap cache index error when retrying reclaim
has been removed from the -mm tree. Its filename was
mm-swap-fix-swap-cache-index-error-when-retrying-reclaim.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Kairui Song <[email protected]>
Subject: mm, swap: fix swap cache index error when retrying reclaim
Date: Wed, 17 Sep 2025 00:00:48 +0800
The allocator will reclaim cached slots while scanning. Currently, it will try again if reclaim found a folio that is already removed from the swap cache due to a race. But the following lookup will be using the wrong index. It won't cause any OOB issue since the swap cache index is truncated upon lookup, but it may lead to reclaiming of an irrelevant folio.
This should not cause a measurable issue, but we should fix it.
---
mm/swapfile.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
mm/swapfile.c renamed from mm/swapfile.c~mm-swap-fix-swap-cache-index-error-when-retrying-reclaim +4 -4
@@ -212,7 +212,7 @@ static bool swap_is_last_map(struct swapstatic int __try_to_reclaim_swap (struct swap_info_struct *si,unsigned long offset,unsigned long flags) { -swp_entry_t entry =swp_entry (si->type, offset); +const swp_entry_t entry =swp_entry (si->type, offset);struct swap_cluster_info *ci;struct folio *folio;int ret, nr_pages;
@@ -240,13 +240,13 @@ again:* Offset could point to the middle of a large folio, or folio * may no longer point to the expected offset before it's locked. */ - entry = folio->swap; -if (offset <swp_offset (entry) || offset >=swp_offset (entry) + nr_pages) { +if (offset <swp_offset (folio->swap) || + offset >=swp_offset (folio->swap) + nr_pages) {folio_unlock (folio);folio_put (folio); goto again; } - offset =swp_offset (entry); + offset =swp_offset (folio->swap); need_reclaim = ((flags & TTRS_ANYWAY) || ((flags & TTRS_UNMAPPED) && !folio_mapped(folio)) ||
_
Patches currently in -mm which might be from [email protected] are