> -----Original Message----- > From: Sridhar, Kanchana P <kanchana.p.sridhar@xxxxxxxxx> > Sent: Friday, August 22, 2025 2:58 PM > To: Nhat Pham <nphamcs@xxxxxxxxx> > Cc: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>; linux- > kernel@xxxxxxxxxxxxxxx; linux-mm@xxxxxxxxx; hannes@xxxxxxxxxxx; > yosry.ahmed@xxxxxxxxx; chengming.zhou@xxxxxxxxx; > usamaarif642@xxxxxxxxx; ryan.roberts@xxxxxxx; 21cnbao@xxxxxxxxx; > ying.huang@xxxxxxxxxxxxxxxxx; akpm@xxxxxxxxxxxxxxxxxxxx; > senozhatsky@xxxxxxxxxxxx; linux-crypto@xxxxxxxxxxxxxxx; > davem@xxxxxxxxxxxxx; clabbe@xxxxxxxxxxxx; ardb@xxxxxxxxxx; > ebiggers@xxxxxxxxxx; surenb@xxxxxxxxxx; Accardi, Kristen C > <kristen.c.accardi@xxxxxxxxx>; Gomes, Vinicius <vinicius.gomes@xxxxxxxxx>; > Feghali, Wajdi K <wajdi.k.feghali@xxxxxxxxx>; Gopal, Vinodh > <vinodh.gopal@xxxxxxxxx>; Sridhar, Kanchana P > <kanchana.p.sridhar@xxxxxxxxx> > Subject: RE: [PATCH v11 18/24] crypto: acomp - Add > crypto_acomp_batch_size() to get an algorithm's batch-size. > > > > -----Original Message----- > > From: Nhat Pham <nphamcs@xxxxxxxxx> > > Sent: Friday, August 22, 2025 2:48 PM > > To: Sridhar, Kanchana P <kanchana.p.sridhar@xxxxxxxxx> > > Cc: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>; linux- > > kernel@xxxxxxxxxxxxxxx; linux-mm@xxxxxxxxx; hannes@xxxxxxxxxxx; > > yosry.ahmed@xxxxxxxxx; chengming.zhou@xxxxxxxxx; > > usamaarif642@xxxxxxxxx; ryan.roberts@xxxxxxx; 21cnbao@xxxxxxxxx; > > ying.huang@xxxxxxxxxxxxxxxxx; akpm@xxxxxxxxxxxxxxxxxxxx; > > senozhatsky@xxxxxxxxxxxx; linux-crypto@xxxxxxxxxxxxxxx; > > davem@xxxxxxxxxxxxx; clabbe@xxxxxxxxxxxx; ardb@xxxxxxxxxx; > > ebiggers@xxxxxxxxxx; surenb@xxxxxxxxxx; Accardi, Kristen C > > <kristen.c.accardi@xxxxxxxxx>; Gomes, Vinicius > <vinicius.gomes@xxxxxxxxx>; > > Feghali, Wajdi K <wajdi.k.feghali@xxxxxxxxx>; Gopal, Vinodh > > <vinodh.gopal@xxxxxxxxx> > > Subject: Re: [PATCH v11 18/24] crypto: acomp - Add > > crypto_acomp_batch_size() to get an algorithm's batch-size. > > > > On Fri, Aug 22, 2025 at 12:31 PM Sridhar, Kanchana P > > <kanchana.p.sridhar@xxxxxxxxx> wrote: > > > > > > > > > > -----Original Message----- > > > > From: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> > > > > Sent: Thursday, August 14, 2025 10:29 PM > > > > To: Sridhar, Kanchana P <kanchana.p.sridhar@xxxxxxxxx> > > > > Cc: linux-kernel@xxxxxxxxxxxxxxx; linux-mm@xxxxxxxxx; > > > > hannes@xxxxxxxxxxx; yosry.ahmed@xxxxxxxxx; nphamcs@xxxxxxxxx; > > > > chengming.zhou@xxxxxxxxx; usamaarif642@xxxxxxxxx; > > > > ryan.roberts@xxxxxxx; 21cnbao@xxxxxxxxx; > > > > ying.huang@xxxxxxxxxxxxxxxxx; akpm@xxxxxxxxxxxxxxxxxxxx; > > > > senozhatsky@xxxxxxxxxxxx; linux-crypto@xxxxxxxxxxxxxxx; > > > > davem@xxxxxxxxxxxxx; clabbe@xxxxxxxxxxxx; ardb@xxxxxxxxxx; > > > > ebiggers@xxxxxxxxxx; surenb@xxxxxxxxxx; Accardi, Kristen C > > > > <kristen.c.accardi@xxxxxxxxx>; Gomes, Vinicius > > <vinicius.gomes@xxxxxxxxx>; > > > > Feghali, Wajdi K <wajdi.k.feghali@xxxxxxxxx>; Gopal, Vinodh > > > > <vinodh.gopal@xxxxxxxxx> > > > > Subject: Re: [PATCH v11 18/24] crypto: acomp - Add > > > > crypto_acomp_batch_size() to get an algorithm's batch-size. > > > > > > > > On Thu, Jul 31, 2025 at 09:36:36PM -0700, Kanchana P Sridhar wrote: > > > > > > > > > > diff --git a/include/crypto/internal/acompress.h > > > > b/include/crypto/internal/acompress.h > > > > > index ffffd88bbbad3..2325ee18e7a10 100644 > > > > > --- a/include/crypto/internal/acompress.h > > > > > +++ b/include/crypto/internal/acompress.h > > > > > @@ -28,6 +28,8 @@ > > > > > * > > > > > * @compress: Function performs a compress operation > > > > > * @decompress: Function performs a de-compress operation > > > > > + * @get_batch_size: Maximum batch-size for batching > > > > compress/decompress > > > > > + * operations. > > > > > * @init: Initialize the cryptographic transformation object. > > > > > * This function is used to initialize the cryptographic > > > > > * transformation object. This function is called only once at > > > > > @@ -46,6 +48,7 @@ > > > > > struct acomp_alg { > > > > > int (*compress)(struct acomp_req *req); > > > > > int (*decompress)(struct acomp_req *req); > > > > > + unsigned int (*get_batch_size)(void); > > > > > > > > I can't imagine a situation where this needs to be dynamic. > > > > Please just make it a static value rather than a callback function. > > > > > > Hi Herbert, > > > > > > I am not sure I understand.. Kernel users such as zswap/zram need to > query > > > the algorithm to get the maximum supported batch-size so they can > allocate > > > resources for dst buffers. The get_batch_size() callback and associated > > > crypto_acomp_batch_size() wrapper help accomplish this. > > > > I think he meant stored it as a static unsigned int field, rather than > > a function pointer (i.e dynamic) like this. > > I see. Got it! Sure, I will make this change in v12. Thanks Nhat! > > Best regards, > Kanchana > > > > > Does batch size ever change at runtime? No, batch size doesn't change at runtime. Thanks, Kanchana