mm-swap-remove-duplicate-nr_swap_pages-decrement-in-get_swap_page_of_type.patch removed from -mm tree
The quilt patch titled
Subject: mm: swap: remove duplicate nr_swap_pages decrement in get_swap_page_of_type()
has been removed from the -mm tree. Its filename was
mm-swap-remove-duplicate-nr_swap_pages-decrement-in-get_swap_page_of_type.patch
This patch was dropped because it was merged into the mm-hotfixes-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Youngjun Park <[email protected]>
Subject: mm: swap: remove duplicate nr_swap_pages decrement in get_swap_page_of_type()
Date: Sun, 2 Nov 2025 17:24:56 +0900
After commit 4f78252da887, nr_swap_pages is decremented in swap_range_alloc(). Since cluster_alloc_swap_entry() calls swap_range_alloc() internally, the decrement in get_swap_page_of_type() causes double-decrementing.
As a representative userspace-visible runtime example of the impact, /proc/meminfo reports increasingly inaccurate SwapFree values. The discrepancy grows with each swap allocation, and during hibernation when large amounts of memory are written to swap, the reported value can deviate significantly from actual available swap space, misleading users and monitoring tools.
Remove the duplicate decrement.
---
mm/swapfile.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
mm/swapfile.c renamed from mm/swapfile.c~mm-swap-remove-duplicate-nr_swap_pages-decrement-in-get_swap_page_of_type +1 -3
@@ -2005,10 +2005,8 @@ swp_entry_t get_swap_page_of_type(int tylocal_lock (&percpu_swap_cluster.lock); offset =cluster_alloc_swap_entry (si,0 ,1 );local_unlock (&percpu_swap_cluster.lock); -if (offset) { +if (offset) entry =swp_entry (si->type, offset); -atomic_long_dec (&nr_swap_pages); - } }put_swap_device (si); }
_
Patches currently in -mm which might be from [email protected] are
mm-swap-fix-wrong-plist-empty-check-in-swap_alloc_slow.patch mm-swap-fix-memory-leak-in-setup_clusters-error-path.patch mm-swap-use-swp_solidstate-to-determine-if-swap-is-rotational.patch mm-swap-remove-redundant-comment-for-read_swap_cache_async.patch mm-swap-change-swap_alloc_slow-to-void.patch mm-swap-remove-scan_swap_map_slots-references-from-comments.patch