Re: [PATCH] mm: zswap: add VM_BUG_ON() if large folio swapin is attempted
From: Yosry Ahmed
Date: Fri Jun 07 2024 - 19:17:59 EST
[..]
> > One problem is that even if zswap was never enabled, the warning will
> > be emitted just if CONFIG_ZSWAP is on. Perhaps we need a variable or
> > static key if zswap was "ever" enabled.
> >
> > Barry, I suspect your is_zswap_enabled() check is deficient for
> > similar reasons, zswap could have been enabled before then became
> > disabled.
>
> I don't understand this. if zswap was enabled before but is disabled when
> I am loading data, will I get corrupted data before zswap was once enabled?
> If not, it seems nothing important.
If zswap was enabled and then disabled, some pages may still be in
zswap. We do not load the pages from zswap when it is disabled, we
just stop storing new pages.
So if you just rely in checking whether zswap is enabled at swapin
time to decide whether to use large folios, you may end up with a
situation where zswap is disabled, yet parts of the large folio you
are trying to swapin (or all of it) is in zswap.
This is why I think we'll need to track whether zswap was ever enabled
instead (or if a page was ever stored).
>
> Thanks
> Barry