From: Miaohe Lin Date: Thu, 19 May 2022 21:08:51 +0000 (-0700) Subject: mm/swap: remove buggy cache->nr check in refill_swap_slots_cache X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=f19c25684c3e19b329e0498dd6d601df13c33223;p=linux.git mm/swap: remove buggy cache->nr check in refill_swap_slots_cache refill_swap_slots_cache is always called when cache->nr is 0. So remove such buggy and confusing check. Link: https://lkml.kernel.org/r/20220509131416.17553-7-linmiaohe@huawei.com Signed-off-by: Miaohe Lin Acked-by: David Hildenbrand Reviewed-by: Oscar Salvador Cc: Alistair Popple Cc: David Howells Cc: Matthew Wilcox Cc: Naoya Horiguchi Cc: NeilBrown Cc: Peter Xu Cc: Suren Baghdasaryan Cc: Vlastimil Babka Signed-off-by: Andrew Morton --- diff --git a/mm/swap_slots.c b/mm/swap_slots.c index 2f877e6f87d70..2a65a89b5b4d7 100644 --- a/mm/swap_slots.c +++ b/mm/swap_slots.c @@ -258,7 +258,7 @@ out_unlock: /* called with swap slot cache's alloc lock held */ static int refill_swap_slots_cache(struct swap_slots_cache *cache) { - if (!use_swap_slot_cache || cache->nr) + if (!use_swap_slot_cache) return 0; cache->cur = 0;