From: YoungJun Park <youngjun.park@lge.com>
To: Chris Mason <clm@meta.com>
Cc: akpm@linux-foundation.org, stable@kernel.org, chrisl@kernel.org,
kasong@tencent.com, shikemeng@huaweicloud.com, nphamcs@gmail.com,
bhe@redhat.com, baohua@kernel.org, linux-mm@kvack.org,
stable@vger.kernel.org
Subject: Re: [PATCH v2 1/2] mm/swapfile: fix list iteration when next node is removed during discard
Date: Sun, 22 Feb 2026 10:41:50 +0900 [thread overview]
Message-ID: <aZpe3kD/xmz87zYH@yjaykim-PowerEdge-T330> (raw)
In-Reply-To: <20260220151338.3234934-1-clm@meta.com>
On Fri, Feb 20, 2026 at 07:13:33AM -0800, Chris Mason wrote:
> On Thu, 27 Nov 2025 19:03:02 +0900 Youngjun Park <youngjun.park@lge.com> wrote:
>
> > When the next node is removed from the plist (e.g. by swapoff),
> > plist_del() makes the node point to itself, causing the iteration to
> > loop on the same entry indefinitely.
> >
> > Add a plist_node_empty() check to detect this case and restart
> > iteration, allowing swap_sync_discard() to continue processing
> > remaining swap devices that still have pending discard entries.
> >
> > Additionally, switch from swap_avail_lock/swap_avail_head to
> > swap_lock/swap_active_head so that iteration is only affected by
> > swapoff operations rather than frequent availability changes,
> > reducing exceptional condition checks and lock contention.
> >
> > Fixes: 686ea517f471 ("mm, swap: do not perform synchronous discard during allocation")
> > Suggested-by: Kairui Song <kasong@tencent.com>
> > Acked-by: Kairui Song <kasong@tencent.com>
> > Signed-off-by: Youngjun Park <youngjun.park@lge.com>
> >
>
> Hi everyone,
>
> This fix landed upstream in v6.19-rc1:
>
> commit f9e82f99b3771eef396dbf97e0f3c76e20af60dd
> Author: Youngjun Park <youngjun.park@lge.com>
> Date: Thu Nov 27 19:03:02 2025 +0900
> Subject: mm/swapfile: fix list iteration when next node is removed during discard
>
> Looks like the commit being fixed is actually:
>
> commit 9fb749cd15078c7bdc46e5d45c37493f83323e33
> Author: Kairui Song <kasong@tencent.com>
> Date: Fri Oct 24 02:34:11 2025 +0800
> Subject: mm, swap: do not perform synchronous discard during allocation
>
> v6.18.y stable has Kairui Song's commit, but this fix hasn't made it to stable.
> Johannes noticed the Fixes: tag doesn't match, which probably explains
> the gap, but I think we should pull this fix (f9e82f99b) in.
+Cc: stable@vger.kernel.org
Thanks for catching this and pushing for the stable backport.
Acked-by: Youngjun Park youngjun.park@lge.com
next prev parent reply other threads:[~2026-02-22 1:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-27 10:03 [PATCH v2 0/2] mm/swapfile: fix and cleanup swap list iterations Youngjun Park
2025-11-27 10:03 ` [PATCH v2 1/2] mm/swapfile: fix list iteration when next node is removed during discard Youngjun Park
2025-11-27 10:48 ` Baoquan He
2026-02-20 15:13 ` Chris Mason
2026-02-22 1:41 ` YoungJun Park [this message]
2025-11-27 10:03 ` [PATCH v2 2/2] mm/swapfile: use plist_for_each_entry in __folio_throttle_swaprate Youngjun Park
2025-11-27 10:51 ` Baoquan He
2025-11-28 2:45 ` Kairui Song
2025-11-28 15:02 ` Chris Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aZpe3kD/xmz87zYH@yjaykim-PowerEdge-T330 \
--to=youngjun.park@lge.com \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=bhe@redhat.com \
--cc=chrisl@kernel.org \
--cc=clm@meta.com \
--cc=kasong@tencent.com \
--cc=linux-mm@kvack.org \
--cc=nphamcs@gmail.com \
--cc=shikemeng@huaweicloud.com \
--cc=stable@kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox