Re: [RFC PATCH v3 7/8] mm/zswap: compressed ram direct integration
From: Gregory Price
Date: Mon Jan 12 2026 - 18:46:43 EST
On Mon, Jan 12, 2026 at 06:33:16PM -0500, Gregory Price wrote:
> One of the assumptions you have in zswap is that there's some known
> REAL chunk of memory X-GB, and the compression ratio dictates that you
> get to cram more than X-GB of data in there.
>
> This device flips that on its head. It lies to the system and says
> there's X-GB, and you can only actually use a fraction of it in the
> worst case - and in the best case you use all of it.
>
> So in that sense, zswap has "infinite upside" (if you're infinitely
> compressible), whereas this device has "limited upside" (node capacity).
>
> That changes how you account for things entirely, and that's why
> entry->length always has to be PAGE_SIZE. Even if the device can tell
> us the real size, i'm not sure how useful that is - you still have to
> charge for an entire `struct page`.
>
> Time for a good long :think:
>
hmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
now that i have written this out, I wonder if the answer here is for the
zswap_node controller (cxl driver or whatever) to detect high memory
usage and online a new memory block if there is additional capacity
available.
This would look like the swap file increasing in size dynamically,
which is *also* problematic, but it's at least in the same ballpark.
>From a CXL perspective, this would look like a dynamic capacity device.
And the catch would be that we would need the opposite interface:
zswap.c or cram.c would need an explicit evict interface to allow
capacity to be offlined if the device needs to shrink the "fake"
capacity in response to shrinking compression ratios.
Time for a much, much longer :think:
~Gregory