+Yosry & Yuanchu On Thu, Apr 28, 2022 at 8:17 AM Johannes Weiner <hannes@xxxxxxxxxxx> wrote: > [...] > > > > Yes, we have some modifications to zswap to make it work without any > > backing real swap. > > Not sure if you can share them, but I would be interested in those > changes. We have real backing swap, but because of the way swap > entries are allocated, pages stored in zswap will consume physical > disk slots. So on top of regular swap, you need to provision disk > space for zswap as well, which is unfortunate. > > What could be useful is a separate swap entry address space that maps > zswap slots and disk slots alike. This would fix the above problem. It > would have the added benefit of making swapoff much simpler and faster > too, as it doesn't need to chase down page tables to free disk slots. > I think we can share the code. Adding Yosry & Yuanchu who are currently maintaining that piece of code. Though that code might not be in an upstreamable state. At the high level, it introduces a new type of swap (SWP_GHOST) which underlying is a truncated file, so no real disk space is needed. The zswap always accepts the page, so the kernel never tries to go to the underlying swapfile (reality is a bit more complicated due to the presence of incompressible memory and no real disk present on the system).