Global total_swap_pages can indicate if usable swap deivice is present, use it instead of __has_usable_swap(). Signed-off-by: Baoquan He --- mm/swapfile.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/mm/swapfile.c b/mm/swapfile.c index 2bd8bd76ea28..5d71c748a2fe 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -3836,11 +3836,6 @@ static void free_swap_count_continuations(struct swap_info_struct *si) } #if defined(CONFIG_MEMCG) && defined(CONFIG_BLK_CGROUP) -static bool __has_usable_swap(void) -{ - return !plist_head_empty(&swap_active_head); -} - void __folio_throttle_swaprate(struct folio *folio, gfp_t gfp) { struct swap_info_struct *si, *next; @@ -3848,7 +3843,7 @@ void __folio_throttle_swaprate(struct folio *folio, gfp_t gfp) if (!(gfp & __GFP_IO)) return; - if (!__has_usable_swap()) + if (!total_swap_pages) return; if (!blk_cgroup_congested()) -- 2.41.0