]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mm/swapfile: use plist_for_each_entry in __folio_throttle_swaprate
authorYoungjun Park <youngjun.park@lge.com>
Thu, 27 Nov 2025 10:03:03 +0000 (19:03 +0900)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 29 Nov 2025 18:41:11 +0000 (10:41 -0800)
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 <youngjun.park@lge.com>
Reviewed-by: Baoquan He <bhe@redhat.com>
Acked-by: Kairui Song <kasong@tencent.com>
Acked-by: Chris Li <chrisl@kernel.org>
Cc: Barry Song <baohua@kernel.org>
Cc: Kemeng Shi <shikemeng@huaweicloud.com>
Cc: Nhat Pham <nphamcs@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/swapfile.c

index 8116f36e440bc828495564df25824ff673a06ef4..46d2008e4b9960444c079138b473764cf6fd6c5e 100644 (file)
@@ -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;