[PATCH 0/2] fix WARN_ON in add_to_avail_list

From: Wupeng Ma
Date: Tue Jun 27 2023 - 08:08:55 EST


From: Ma Wupeng <mawupeng1@xxxxxxxxxx>

Our test find a WARN_ON in add_to_avail_list. During add_to_avail_list,
avail_lists is already in swap_avail_heads, while lead to this WARN_ON.

During swapoff, try_to_unuse fail to alloc memory due to memory limit and
this lead the failure of swapoff and casing re-insert swap space back into
swap_list. During _enable_swap_info, this swap device is added to avail
list even this swap device if full. At the same time, one entry in this
full swap device in released and try to add this device into avail list
and found it is already in the avail list. This cause this WARN_ON.

Ma Wupeng (2):
swap: Cleanup duplicated WARN_ON in add_to_avail_list
swap: Stop add to avail list is swap is full

mm/swapfile.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

--
2.25.1