[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <PH7PR11MB8121663B9F5A2210B8431C9FC9E9A@PH7PR11MB8121.namprd11.prod.outlook.com>
Date: Thu, 16 Oct 2025 00:56:59 +0000
From: "Sridhar, Kanchana P" <kanchana.p.sridhar@...el.com>
To: Nhat Pham <nphamcs@...il.com>, Yosry Ahmed <yosry.ahmed@...ux.dev>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>, "hannes@...xchg.org"
<hannes@...xchg.org>, "chengming.zhou@...ux.dev" <chengming.zhou@...ux.dev>,
"usamaarif642@...il.com" <usamaarif642@...il.com>, "ryan.roberts@....com"
<ryan.roberts@....com>, "21cnbao@...il.com" <21cnbao@...il.com>,
"ying.huang@...ux.alibaba.com" <ying.huang@...ux.alibaba.com>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"senozhatsky@...omium.org" <senozhatsky@...omium.org>, "sj@...nel.org"
<sj@...nel.org>, "kasong@...cent.com" <kasong@...cent.com>,
"linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>,
"herbert@...dor.apana.org.au" <herbert@...dor.apana.org.au>,
"davem@...emloft.net" <davem@...emloft.net>, "clabbe@...libre.com"
<clabbe@...libre.com>, "ardb@...nel.org" <ardb@...nel.org>,
"ebiggers@...gle.com" <ebiggers@...gle.com>, "surenb@...gle.com"
<surenb@...gle.com>, "Accardi, Kristen C" <kristen.c.accardi@...el.com>,
"Gomes, Vinicius" <vinicius.gomes@...el.com>, "Feghali, Wajdi K"
<wajdi.k.feghali@...el.com>, "Gopal, Vinodh" <vinodh.gopal@...el.com>,
"Sridhar, Kanchana P" <kanchana.p.sridhar@...el.com>
Subject: RE: [PATCH v12 22/23] mm: zswap: zswap_store() will process a large
folio in batches.
> -----Original Message-----
> From: Nhat Pham <nphamcs@...il.com>
> Sent: Wednesday, October 15, 2025 3:36 PM
> To: Yosry Ahmed <yosry.ahmed@...ux.dev>
> Cc: Sridhar, Kanchana P <kanchana.p.sridhar@...el.com>; linux-
> kernel@...r.kernel.org; linux-mm@...ck.org; hannes@...xchg.org;
> chengming.zhou@...ux.dev; usamaarif642@...il.com;
> ryan.roberts@....com; 21cnbao@...il.com;
> ying.huang@...ux.alibaba.com; akpm@...ux-foundation.org;
> senozhatsky@...omium.org; sj@...nel.org; kasong@...cent.com; linux-
> crypto@...r.kernel.org; herbert@...dor.apana.org.au;
> davem@...emloft.net; clabbe@...libre.com; ardb@...nel.org;
> ebiggers@...gle.com; surenb@...gle.com; Accardi, Kristen C
> <kristen.c.accardi@...el.com>; Gomes, Vinicius <vinicius.gomes@...el.com>;
> Feghali, Wajdi K <wajdi.k.feghali@...el.com>; Gopal, Vinodh
> <vinodh.gopal@...el.com>
> Subject: Re: [PATCH v12 22/23] mm: zswap: zswap_store() will process a
> large folio in batches.
>
> On Wed, Oct 15, 2025 at 3:24 PM Yosry Ahmed <yosry.ahmed@...ux.dev>
> 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 :)
Thanks Nhat and Yosry, for sharing these constraints and ideas.
Sure, I will see if I can use the bit fields approach and will make sure
to not increase the size of struct zswap_entry. If this doesn't work
for some reason, we have the simple route.
Best regards,
Kanchana
Powered by blists - more mailing lists