Commit c2307195 authored by Youngjun Park's avatar Youngjun Park Committed by Andrew Morton
Browse files

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: 8e689f8e ("mm/swap: do not choose swap device according to numa node")
Signed-off-by: default avatarYoungjun Park <youngjun.park@lge.com>
Acked-by: default avatarKairui Song <kasong@tencent.com>
Reviewed-by: default avatarBaoquan 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: default avatarAndrew Morton <akpm@linux-foundation.org>
parent a9ce09b1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1374,7 +1374,7 @@ static bool swap_alloc_slow(swp_entry_t *entry,
		 * 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);