From: Youngjun Park Date: Thu, 27 Nov 2025 10:03:03 +0000 (+0900) Subject: mm/swapfile: use plist_for_each_entry in __folio_throttle_swaprate X-Git-Tag: v6.19-rc1~112^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b60a3ef7848dbcc9549137f8d42dcd82210c0b66;p=thirdparty%2Flinux.git mm/swapfile: use plist_for_each_entry in __folio_throttle_swaprate 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. Link: https://lkml.kernel.org/r/20251127100303.783198-3-youngjun.park@lge.com Signed-off-by: Youngjun Park Reviewed-by: Baoquan He Acked-by: Kairui Song Acked-by: Chris Li Cc: Barry Song Cc: Kemeng Shi Cc: Nhat Pham Signed-off-by: Andrew Morton --- diff --git a/mm/swapfile.c b/mm/swapfile.c index 8116f36e440bc..46d2008e4b996 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;