Re: [PATCH v2] mm: cma: print cma name as well in cma_alloc debug

From: Matthew Wilcox
Date: Fri Jul 07 2023 - 08:46:35 EST


On Fri, Jul 07, 2023 at 03:57:42PM +0530, Anshuman Khandual wrote:
> LGTM, cma->name is an identifying attribute for the region for which the allocation
> request was made. But how about using cma_get_name() helper instead ? Very few call
> sites have been using the helper.

It's not really a "helper", is it? The function name is longer than
its implementation.

cma_get_name(cma)
vs
cma->name

Plus there's the usual question about whether a "got" name needs to be
"put" (does it grab a refcount?)

I think it's useful that this function exists since it lets us not expose
struct cma outside of mm/, but it really should be called cma_name()
and I don't think we should be encouraging its use within cma.c.