Re: [PATCH v3 2/3] mm: zswap: add zswap_never_enabled()
From: Nhat Pham
Date: Tue Jun 11 2024 - 12:33:39 EST
On Mon, Jun 10, 2024 at 7:45 PM Yosry Ahmed <yosryahmed@xxxxxxxxxx> wrote:
>
> Add zswap_never_enabled() to skip the xarray lookup in zswap_load() if
> zswap was never enabled on the system. It is implemented using static
> branches for efficiency, as enabling zswap should be a rare event. This
> could shave some cycles off zswap_load() when CONFIG_ZSWAP is used but
> zswap is never enabled.
>
> However, the real motivation behind this patch is two-fold:
> - Incoming large folio swapin work will need to fallback to order-0
> folios if zswap was ever enabled, because any part of the folio could
> be in zswap, until proper handling of large folios with zswap is
> added.
>
> - A warning and recovery attempt will be added in a following change in
> case the above was not done incorrectly. Zswap will fail the read if
> the folio is large and it was ever enabled.
>
> Signed-off-by: Yosry Ahmed <yosryahmed@xxxxxxxxxx>
This LGTM.
Reviewed-by: Nhat Pham <nphamcs@xxxxxxxxx>