Skip to content

Commit c230719

Browse files
youngjuniakpm00
authored andcommitted
mm/swap: fix wrong plist empty check in swap_alloc_slow()
swap_alloc_slow() was checking `si->avail_list` instead of `next->avail_list` when verifying if the next swap device is still in the list, which could cause unnecessary restarts during allocation. Link: https://lkml.kernel.org/r/20251119114136.594108-1-youngjun.park@lge.com Fixes: 8e689f8 ("mm/swap: do not choose swap device according to numa node") Signed-off-by: Youngjun Park <youngjun.park@lge.com> Acked-by: Kairui Song <kasong@tencent.com> Reviewed-by: Baoquan He <bhe@redhat.com> Cc: Barry Song <baohua@kernel.org> Cc: Chris Li <chrisl@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 a9ce09b commit c230719

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

mm/swapfile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1374,7 +1374,7 @@ static bool swap_alloc_slow(swp_entry_t *entry,
13741374
* still in the swap_avail_head list then try it, otherwise
13751375
* start over if we have not gotten any slots.
13761376
*/
1377-
if (plist_node_empty(&si->avail_list))
1377+
if (plist_node_empty(&next->avail_list))
13781378
goto start_over;
13791379
}
13801380
spin_unlock(&swap_avail_lock);

0 commit comments

Comments
 (0)