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

From: Anshuman Khandual
Date: Fri Jul 07 2023 - 06:28:04 EST




On 7/7/23 00:03, Pintu Kumar wrote:
> CMA allocation can happen either from global cma or from
> dedicated cma region.
>
> Thus it is helpful to print cma name as well during initial
> debugging to confirm cma regions were getting initialized or not.
>
> Signed-off-by: Pintu Kumar <quic_pintu@xxxxxxxxxxx>
> Signed-off-by: Pintu Agarwal <pintu.ping@xxxxxxxxx>
> ---
> mm/cma.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/cma.c b/mm/cma.c
> index a4cfe99..4880f72 100644
> --- a/mm/cma.c
> +++ b/mm/cma.c
> @@ -436,8 +436,8 @@ struct page *cma_alloc(struct cma *cma, unsigned long count,
> if (!cma || !cma->count || !cma->bitmap)
> goto out;
>
> - pr_debug("%s(cma %p, count %lu, align %d)\n", __func__, (void *)cma,
> - count, align);
> + pr_debug("%s(cma %p, name: %s, count %lu, align %d)\n", __func__,
> + (void *)cma, cma->name, count, align);
>
> if (!count)
> goto out;

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.