Re: [PATCH 02/12] cgroup: rstat: Make cgroup_rstat_cpu_lock name readable

From: Namhyung Kim
Date: Tue Feb 08 2022 - 18:52:01 EST


On Tue, Feb 8, 2022 at 11:16 AM Namhyung Kim <namhyung@xxxxxxxxxx> wrote:
>
> Hi Tejun,
>
> On Tue, Feb 8, 2022 at 10:46 AM Tejun Heo <tj@xxxxxxxxxx> wrote:
> >
> > On Tue, Feb 08, 2022 at 10:41:58AM -0800, Namhyung Kim wrote:
> > > The raw_spin_lock_init() uses the argument to name its lockdep map.
> > > But passing per_cpu_ptr() macro directly makes it a very very long
> > > name as it expanded like below:
> > >
> > > ({ do { const void *__vpp_verify = (typeof((&cgroup_rstat_cpu_lock) ...
> > >
> > > Let's fix it by passing a local variable instead. With this change,
> > > the name now looks like:
> > >
> > > cgrp_rstat_cpu_lock
> > >
> > > Cc: Tejun Heo <tj@xxxxxxxxxx>
> > > Cc: Zefan Li <lizefan.x@xxxxxxxxxxxxx>
> > > Cc: Johannes Weiner <hannes@xxxxxxxxxxx>
> > > Cc: cgroups@xxxxxxxxxxxxxxx
> > > Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
> >
> > Acked-by: Tejun Heo <tj@xxxxxxxxxx>
>
> Thanks!
>
> >
> > but maybe add a comment explaining what's going on?
>
> Sure, I'll add the comment.

Actually it depends on CONFIG_DEBUG_SPINLOCK.
If it's enabled, the name looks fine. But if not, the macro
expansion would happen and generate the long name.

Thanks,
Namhyung