[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <PH7PR11MB812181609A0EE53770D81F43C94EA@PH7PR11MB8121.namprd11.prod.outlook.com>
Date: Tue, 8 Jul 2025 00:03:11 +0000
From: "Sridhar, Kanchana P" <kanchana.p.sridhar@...el.com>
To: Al Viro <viro@...iv.linux.org.uk>
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>, "yosry.ahmed@...ux.dev" <yosry.ahmed@...ux.dev>,
"nphamcs@...il.com" <nphamcs@...il.com>, "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>, "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 v1 1/2] mm: zswap: Per-CPU acomp_ctx resources exist from
pool creation to deletion.
> -----Original Message-----
> From: Al Viro <viro@....linux.org.uk> On Behalf Of Al Viro
> Sent: Monday, July 7, 2025 3:06 PM
> To: Sridhar, Kanchana P <kanchana.p.sridhar@...el.com>
> Cc: linux-kernel@...r.kernel.org; linux-mm@...ck.org;
> hannes@...xchg.org; yosry.ahmed@...ux.dev; nphamcs@...il.com;
> 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; Feghali, Wajdi K <wajdi.k.feghali@...el.com>;
> Gopal, Vinodh <vinodh.gopal@...el.com>
> Subject: Re: [PATCH v1 1/2] mm: zswap: Per-CPU acomp_ctx resources exist
> from pool creation to deletion.
>
> On Mon, Jul 07, 2025 at 01:13:14PM -0700, Kanchana P Sridhar wrote:
>
> > +static void acomp_ctx_dealloc(struct crypto_acomp_ctx *acomp_ctx)
> > +{
> > + if (IS_ERR_OR_NULL(acomp_ctx))
>
> Ugh.
>
> > + return;
> > +
> > + if (!IS_ERR_OR_NULL(acomp_ctx->req))
>
> Ugh.
>
> > + acomp_request_free(acomp_ctx->req);
> > +
> > + if (!IS_ERR_OR_NULL(acomp_ctx->acomp))
>
> Ugh.
>
> > + crypto_free_acomp(acomp_ctx->acomp);
> > +
> > + kfree(acomp_ctx->buffer);
>
> Just what are those IS_ERR_OR_NULL about? Is it IS_ERR() or is it NULL?
> Either has valid uses, but mixing them is not something you do without a
> good reason; there are valid calling conventions that allow all three of
> "address of an object", NULL and ERR_PTR(-E...), but that's not something
> you do just in case - there should be an explanation of what's going on.
I hope my reply to Nhat clarifies and provides some more context.
In summary, the IS_ERR_OR_NULL() is preserving existing mainline code in
zswap_cpu_comp_dead() in the new acomp_ctx_dealloc(). There is no
teardown callback, i.e., zswap_cpu_comp_dead() with this patch series.
Thanks,
Kanchana
Powered by blists - more mailing lists