On Mon, Nov 03, 2025 at 06:56:08PM -0800, Andrew Morton wrote:
On Sun, 2 Nov 2025 17:24:56 +0900 Youngjun Park youngjun.park@lge.com wrote:
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.
Remove the duplicate decrement.
Can we please have a description of the userspace-visible runtime effects of the bug?
Fixes: 4f78252da887 ("mm: swap: move nr_swap_pages counter decrement from folio_alloc_swap() to swap_range_alloc()") Cc: stable@vger.kernel.org # v6.17-rc1
Especially when proposing a backport.
Thanks.
Hi Andrew,
Thank you for picking up the patch. Since it's already in mm-hotfixes-unstable, I'm providing the elaboration here rather than sending v3.
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.
Best Regards, Youngjun