Re: [PATCH v12 22/23] mm: zswap: zswap_store() will process a large folio in batches.
From: Nhat Pham
Date: Wed Oct 15 2025 - 18:36:19 EST
On Wed, Oct 15, 2025 at 3:24 PM Yosry Ahmed <yosry.ahmed@xxxxxxxxx> wrote:
>
> On Wed, Oct 15, 2025 at 10:15:12PM +0000, Sridhar, Kanchana P wrote:
>
> I am against increasing the size of struct zswap_entry. On x86_64, there
> is a 3 byte hole after 'referenced'. We can technically use that,
> although the node id is usually an int, which is 4 bytes on x86_64.
>
> In practice, I think 2 bytes (i.e. short) should be enough, but it will
> be ugly to cast the node id to a short. We should at least WARN on
> overflow.
Can we pack length and referenced using bit fields? I assume
compressed length cannot exceed 2^31 - 1? :)
So, something along the line of:
struct {
unsigned int length:31;
bool referenced:1;
}
That way, we save up another 4 bytes hole, which can be repurposed for
the node's id.
Does that work? I'm not very experienced with this magickery - please
fact check me :)
>
> Or we can take the simple route and drop the bulk allocation.
Or this :)