Skip to content

Commit b60a3ef

Browse files
youngjuniakpm00
authored andcommitted
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 <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>
1 parent f9e82f9 commit b60a3ef

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

mm/swapfile.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4023,7 +4023,7 @@ static bool __has_usable_swap(void)
40234023

40244024
void __folio_throttle_swaprate(struct folio *folio, gfp_t gfp)
40254025
{
4026-
struct swap_info_struct *si, *next;
4026+
struct swap_info_struct *si;
40274027

40284028
if (!(gfp & __GFP_IO))
40294029
return;
@@ -4042,8 +4042,7 @@ void __folio_throttle_swaprate(struct folio *folio, gfp_t gfp)
40424042
return;
40434043

40444044
spin_lock(&swap_avail_lock);
4045-
plist_for_each_entry_safe(si, next, &swap_avail_head,
4046-
avail_list) {
4045+
plist_for_each_entry(si, &swap_avail_head, avail_list) {
40474046
if (si->bdev) {
40484047
blkcg_schedule_throttle(si->bdev->bd_disk, true);
40494048
break;

0 commit comments

Comments
 (0)