[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251118095432.GN3245006@noisy.programming.kicks-ass.net>
Date: Tue, 18 Nov 2025 10:54:32 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Tim Chen <tim.c.chen@...ux.intel.com>
Cc: Shrikanth Hegde <sshegde@...ux.ibm.com>, linux-kernel@...r.kernel.org,
linux-tip-commits@...r.kernel.org, Chen Yu <yu.c.chen@...el.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
K Prateek Nayak <kprateek.nayak@....com>,
Srikar Dronamraju <srikar@...ux.ibm.com>,
Mohini Narkhede <mohini.narkhede@...el.com>, x86@...nel.org
Subject: Re: [tip: sched/core] sched/fair: Skip sched_balance_running cmpxchg
when balance is not due
On Mon, Nov 17, 2025 at 10:55:07AM -0800, Tim Chen wrote:
> > if (!need_unlock && (sd->flags & SD_SERIALIZE)) {
> > - if (!atomic_try_cmpxchg_acquire(&sched_balance_running, 0, 1))
>
> The second argument of atomic_try_cmpxchg_acquire is "int *old" while that of atomic_cmpxchg_acquire
> is "int old". So the above check would result in NULL pointer access. Probably have
> to do something like the following to use atomic_try_cmpxchg_acquire()
>
> int zero = 0;
> if (!atomic_try_cmpxchg_acquire(&sched_balance_running, &zero, 1))
>
> Otherwise we should do atomic_cmpxchg_acquire() as below
Yes, and I'm all mightily miffed all the compilers accept 0 (which is
int) for an 'int *' argument without so much as a warning :/
Nathan, you looked into this a bit yesterday, afaict there is:
-Wzero-as-null-pointer-constant
which is supposed to issue a warn here, but I can't get clang-22 to
object :/ (GCC doesn't take that warning for C mode, only C++, perhaps
that's the problem?).
And then there is modernize-use-nullptr, but that objects to using NULL,
although I suppose we could do:
#define NULL nullptr
to get around that. Except I also cannot get clangd to report on the
issue.
Help?
Powered by blists - more mailing lists