zswap_store() falls through to check_old and walks the swap xarray even when zswap is disabled. Add a zswap_never_enabled() early return matching zswap_load() to avoid unnecessary xarray lookup. Reviewed-by: Johannes Weiner Signed-off-by: Kefeng Wang --- mm/zswap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mm/zswap.c b/mm/zswap.c index 2c06e4e0e130..6197aa71e33c 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -1492,6 +1492,9 @@ bool zswap_store(struct folio *folio) VM_WARN_ON_ONCE(!folio_test_locked(folio)); VM_WARN_ON_ONCE(!folio_test_swapcache(folio)); + if (zswap_never_enabled()) + return false; + if (!zswap_enabled) goto check_old; -- 2.55.0