[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAADnVQK+wjvxmBM7WJOGNK=AqeJ7UHBO4tUZR3Gjc4kfgux1sw@mail.gmail.com>
Date: Wed, 11 Jun 2025 11:20:16 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Vlastimil Babka <vbabka@...e.cz>
Cc: Charlemagne Lasse <charlemagnelasse@...il.com>, Johannes Weiner <hannes@...xchg.org>,
Michal Hocko <mhocko@...nel.org>, Roman Gushchin <roman.gushchin@...ux.dev>,
Shakeel Butt <shakeel.butt@...ux.dev>, Muchun Song <muchun.song@...ux.dev>,
Andrew Morton <akpm@...ux-foundation.org>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>, Clark Williams <clrkwllms@...nel.org>,
Steven Rostedt <rostedt@...dmis.org>, Alexei Starovoitov <ast@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>, Jakub Kicinski <kuba@...nel.org>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>, Davidlohr Bueso <dave@...olabs.net>,
LKML <linux-kernel@...r.kernel.org>,
"open list:CONTROL GROUP (CGROUP)" <cgroups@...r.kernel.org>, linux-mm <linux-mm@...ck.org>,
linux-rt-devel@...ts.linux.dev
Subject: Re: locking/local_lock, mm: sparse warnings about shadowed variable
On Wed, Jun 11, 2025 at 10:57 AM Vlastimil Babka <vbabka@...e.cz> wrote:
>
> On 6/11/25 19:37, Charlemagne Lasse wrote:
> > HI,
> >
> > when I run `make C=2 mm/mlock.o CHECK="sparse -Wshadow"`, I get a lot of
> >
> > ./include/linux/local_lock.h:88:1: warning: symbol 'l' shadows an earlier one
> > ./include/linux/local_lock.h:88:1: originally declared here
> >
> > after commit
> >
> > 51339d99c0131bc0d16d378e9b05bc498d2967e2 is the first bad commit
> > commit 51339d99c0131bc0d16d378e9b05bc498d2967e2
> > Author: Alexei Starovoitov <ast@...nel.org>
> > Date: 2025-04-02 19:55:14 -0700
> >
> > locking/local_lock, mm: replace localtry_ helpers with local_trylock_t type
>
> Looks like __DEFINE_LOCK_GUARD_1() has "_type *l" and __local_lock_acquire()
> has "local_lock_t *l;". It can be fixed e.g. like this, although it's
> harmless? The _release() part is not necessary, just for symmetry.
>
> diff --git a/include/linux/local_lock_internal.h b/include/linux/local_lock_internal.h
> index 8d5ac16a9b17..075338f270d0 100644
> --- a/include/linux/local_lock_internal.h
> +++ b/include/linux/local_lock_internal.h
> @@ -97,17 +97,17 @@ do { \
> #define __local_lock_acquire(lock) \
> do { \
> local_trylock_t *tl; \
> - local_lock_t *l; \
> + local_lock_t *ll; \
I wouldn't bother messing with the code because of sparse.
Compilers don't warn here.
Powered by blists - more mailing lists