linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Charlemagne Lasse <charlemagnelasse@gmail.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Vlastimil Babka <vbabka@suse.cz>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Michal Hocko <mhocko@kernel.org>,
	 Roman Gushchin <roman.gushchin@linux.dev>,
	Shakeel Butt <shakeel.butt@linux.dev>,
	 Muchun Song <muchun.song@linux.dev>,
	Andrew Morton <akpm@linux-foundation.org>,
	 Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Clark Williams <clrkwllms@kernel.org>,
	 Steven Rostedt <rostedt@goodmis.org>,
	Alexei Starovoitov <ast@kernel.org>,
	 Thomas Gleixner <tglx@linutronix.de>,
	Jakub Kicinski <kuba@kernel.org>,
	 "Peter Zijlstra (Intel)" <peterz@infradead.org>,
	Davidlohr Bueso <dave@stgolabs.net>,
	 LKML <linux-kernel@vger.kernel.org>,
	 "open list:CONTROL GROUP (CGROUP)" <cgroups@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	 linux-rt-devel@lists.linux.dev
Subject: Re: locking/local_lock, mm: sparse warnings about shadowed variable
Date: Thu, 12 Jun 2025 09:03:27 +0200	[thread overview]
Message-ID: <CAFGhKbwP9e6yWM615FGuq0=eX-57E-f813MMdXZ98D4_+0TveQ@mail.gmail.com> (raw)
In-Reply-To: <CAADnVQK+wjvxmBM7WJOGNK=AqeJ7UHBO4tUZR3Gjc4kfgux1sw@mail.gmail.com>

Am Mi., 11. Juni 2025 um 20:20 Uhr schrieb Alexei Starovoitov
<alexei.starovoitov@gmail.com>:
> I wouldn't bother messing with the code because of sparse.
> Compilers don't warn here.

Actually, they do:

$ make W=2 mm/mlock.o
[...]
In file included from ./include/linux/preempt.h:11,
                from ./include/linux/spinlock.h:56,
                from ./include/linux/wait.h:9,
                from ./include/linux/wait_bit.h:8,
                from ./include/linux/fs.h:7,
                from ./include/linux/mman.h:5,
                from mm/mlock.c:10:
./include/linux/local_lock.h: In function
‘class_local_lock_irqsave_constructor’:
./include/linux/local_lock_internal.h:100:31: warning: declaration of
‘l’ shadows a parameter [-Wshadow]
 100 |                 local_lock_t *l;                                        \
     |                               ^
./include/linux/cleanup.h:394:9: note: in definition of macro
‘__DEFINE_LOCK_GUARD_1’
 394 |         _lock;                                                          \
     |         ^~~~~
./include/linux/local_lock.h:88:1: note: in expansion of macro
‘DEFINE_LOCK_GUARD_1’
  88 | DEFINE_LOCK_GUARD_1(local_lock_irqsave, local_lock_t __percpu,
     | ^~~~~~~~~~~~~~~~~~~
./include/linux/local_lock_internal.h:128:17: note: in expansion of
macro ‘__local_lock_acquire’
 128 |                 __local_lock_acquire(lock);                     \
     |                 ^~~~~~~~~~~~~~~~~~~~
./include/linux/local_lock.h:31:9: note: in expansion of macro
‘__local_lock_irqsave’
  31 |         __local_lock_irqsave(lock, flags)
     |         ^~~~~~~~~~~~~~~~~~~~
./include/linux/local_lock.h:89:21: note: in expansion of macro
‘local_lock_irqsave’
  89 |                     local_lock_irqsave(_T->lock, _T->flags),
     |                     ^~~~~~~~~~~~~~~~~~
./include/linux/cleanup.h:391:68: note: shadowed declaration is here
 391 | static inline class_##_name##_t class_##_name##_constructor(_type *l)   \
./include/linux/cleanup.h:410:1: note: in expansion of macro
‘__DEFINE_LOCK_GUARD_1’
 410 | __DEFINE_LOCK_GUARD_1(_name, _type, _lock)
     | ^~~~~~~~~~~~~~~~~~~~~
./include/linux/local_lock.h:88:1: note: in expansion of macro
‘DEFINE_LOCK_GUARD_1’
  88 | DEFINE_LOCK_GUARD_1


$ gcc --version
gcc (Debian 14.2.0-19) 14.2.0
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


      parent reply	other threads:[~2025-06-12  7:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-11 17:37 Charlemagne Lasse
2025-06-11 17:57 ` Vlastimil Babka
2025-06-11 18:20   ` Alexei Starovoitov
2025-06-11 22:33     ` Andrew Morton
2025-06-12  7:03     ` Charlemagne Lasse [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFGhKbwP9e6yWM615FGuq0=eX-57E-f813MMdXZ98D4_+0TveQ@mail.gmail.com' \
    --to=charlemagnelasse@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexei.starovoitov@gmail.com \
    --cc=ast@kernel.org \
    --cc=bigeasy@linutronix.de \
    --cc=cgroups@vger.kernel.org \
    --cc=clrkwllms@kernel.org \
    --cc=dave@stgolabs.net \
    --cc=hannes@cmpxchg.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-rt-devel@lists.linux.dev \
    --cc=mhocko@kernel.org \
    --cc=muchun.song@linux.dev \
    --cc=peterz@infradead.org \
    --cc=roman.gushchin@linux.dev \
    --cc=rostedt@goodmis.org \
    --cc=shakeel.butt@linux.dev \
    --cc=tglx@linutronix.de \
    --cc=vbabka@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox