From: Youngjun Park Date: Wed, 19 Nov 2025 11:41:36 +0000 (+0900) Subject: mm/swap: fix wrong plist empty check in swap_alloc_slow() X-Git-Tag: v6.19-rc1~112^2~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c23071952394eaef4f06d1b71a90392d2650af0d;p=thirdparty%2Fkernel%2Flinux.git 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: 8e689f8ea45f ("mm/swap: do not choose swap device according to numa node") Signed-off-by: Youngjun Park Acked-by: Kairui Song Reviewed-by: Baoquan He Cc: Barry Song Cc: Chris Li Cc: Kemeng Shi Cc: Nhat Pham Signed-off-by: Andrew Morton --- diff --git a/mm/swapfile.c b/mm/swapfile.c index 94e0f0c541687..cf780fefaf7d7 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -1374,7 +1374,7 @@ start_over: * still in the swap_avail_head list then try it, otherwise * start over if we have not gotten any slots. */ - if (plist_node_empty(&si->avail_list)) + if (plist_node_empty(&next->avail_list)) goto start_over; } spin_unlock(&swap_avail_lock);