[0/2] fix WARN_ON in add_to_avail_list

Message ID 20230627120833.2230766-1-mawupeng1@huawei.com
Headers
Series fix WARN_ON in add_to_avail_list |

Message

mawupeng June 27, 2023, 12:08 p.m. UTC
  From: Ma Wupeng <mawupeng1@huawei.com>

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(-)