[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240124211547.GD217708@kernel.org>
Date: Wed, 24 Jan 2024 21:15:47 +0000
From: Simon Horman <horms@...nel.org>
To: Ratheesh Kannoth <rkannoth@...vell.com>
Cc: Subbaraya Sundeep Bhatta <sbhatta@...vell.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Sunil Kovvuri Goutham <sgoutham@...vell.com>,
"davem@...emloft.net" <davem@...emloft.net>,
"edumazet@...gle.com" <edumazet@...gle.com>,
"kuba@...nel.org" <kuba@...nel.org>,
"pabeni@...hat.com" <pabeni@...hat.com>,
Geethasowjanya Akula <gakula@...vell.com>,
Hariprasad Kelam <hkelam@...vell.com>,
Suman Ghosh <sumang@...vell.com>
Subject: Re: [EXT] Re: [PATCH net] octeontx2-af: Initialize bitmap arrays.
On Wed, Jan 24, 2024 at 10:43:26AM +0000, Ratheesh Kannoth wrote:
> > From: Simon Horman <horms@...nel.org>
> > Subject: Re: [EXT] Re: [PATCH net] octeontx2-af: Initialize bitmap arrays.
> >
> > I think the question is: if the devm_kfree() calls are removed, then is the
> > lifecycle of the objects in question managed correctly?
> If lifecycle of the objects are managed correctly without devm_kfree(), why this API is
> Provided and exported in kernel ?
When the lifecycle of an object is such that it is freed when
the device is detached and at no other time, then devm_* can be helpful
because there is no need for devm_free calls.
I do understand that devm_free() exists, and there are cases where
it makes sense. But I don't think devm_ is buying us anything here.
>
> >
> > > 2. I could see instances of devm_kfree() usage in current kernel where it
> > does explicit calls.
> >
> > Sure. But in this case the use of devm_* doesn't seem to be adding anything
> > if the memory is _always_ freed by explicit calls to devm_kfree().
> I got it. I would like to keep the diff minimal (rather than deleting lines diff). would this be okay ?
My feeling is that if you change your patch to:
1. Use kcalloc() instead of devm_kcalloc()
2. Not change kfree() calls to devm_kfree()
Then you will end up with a smaller diff than the current patch.
And it will address the problem described in the patch description.
Powered by blists - more mailing lists