From: Chris Li <chrisl@kernel.org>
To: Youngjun Park <youngjun.park@lge.com>
Cc: akpm@linux-foundation.org, kasong@tencent.com,
shikemeng@huaweicloud.com, nphamcs@gmail.com, bhe@redhat.com,
baohua@kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH v2 2/2] mm/swapfile: use plist_for_each_entry in __folio_throttle_swaprate
Date: Fri, 28 Nov 2025 19:02:40 +0400 [thread overview]
Message-ID: <CACePvbXC-FWKcvE=8GdKoiX7-yeKD1smnF7UbqQRrtdt6D=Z2A@mail.gmail.com> (raw)
In-Reply-To: <20251127100303.783198-3-youngjun.park@lge.com>
Hi Youngjun,
Thanks for the patch!
Acked-by: Chris Li <chrisl@kernel.org>
Chris
On Thu, Nov 27, 2025 at 2:03 PM Youngjun Park <youngjun.park@lge.com> wrote:
>
> The loop breaks immediately after finding the first swap device and
> never modifies the list. Replace plist_for_each_entry_safe() with
> plist_for_each_entry() and remove the unused next variable.
>
> Signed-off-by: Youngjun Park <youngjun.park@lge.com>
> ---
> mm/swapfile.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/mm/swapfile.c b/mm/swapfile.c
> index 8116f36e440b..46d2008e4b99 100644
> --- a/mm/swapfile.c
> +++ b/mm/swapfile.c
> @@ -4023,7 +4023,7 @@ static bool __has_usable_swap(void)
>
> void __folio_throttle_swaprate(struct folio *folio, gfp_t gfp)
> {
> - struct swap_info_struct *si, *next;
> + struct swap_info_struct *si;
>
> if (!(gfp & __GFP_IO))
> return;
> @@ -4042,8 +4042,7 @@ void __folio_throttle_swaprate(struct folio *folio, gfp_t gfp)
> return;
>
> spin_lock(&swap_avail_lock);
> - plist_for_each_entry_safe(si, next, &swap_avail_head,
> - avail_list) {
> + plist_for_each_entry(si, &swap_avail_head, avail_list) {
> if (si->bdev) {
> blkcg_schedule_throttle(si->bdev->bd_disk, true);
> break;
> --
> 2.34.1
>
prev parent reply other threads:[~2025-11-28 15:03 UTC|newest]
Thread overview: 7+ 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
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 [this message]
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='CACePvbXC-FWKcvE=8GdKoiX7-yeKD1smnF7UbqQRrtdt6D=Z2A@mail.gmail.com' \
--to=chrisl@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=bhe@redhat.com \
--cc=kasong@tencent.com \
--cc=linux-mm@kvack.org \
--cc=nphamcs@gmail.com \
--cc=shikemeng@huaweicloud.com \
--cc=youngjun.park@lge.com \
/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