Re: [PATCH] mm: swap: prejudgement swap_has_cache to avoid page allocation

From: Nhat Pham
Date: Mon Apr 01 2024 - 11:21:30 EST


On Mon, Apr 1, 2024 at 8:15 AM Kairui Song <ryncsn@xxxxxxxxx> wrote:
> eg. If swap_has_cache returns true, then swap cache is freed, and
> skip_if_exists is set to true, __read_swap_cache_async will return
> NULL for an entry that it should be able to alloc and cache, could
> this be a problem (for example, causing zswap writeback to fail with
> ENOMEM due to readahead)?

Yeah the scenario you describe sounds plausible to me. This will make
zswap writeback less efficient - it seems more pages will be
(unnecessarily) skipped because of this check.