[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aTPubK6cXkhhCunO@gmail.com>
Date: Sat, 6 Dec 2025 09:50:52 +0100
From: Ingo Molnar <mingo@...nel.org>
To: Arnd Bergmann <arnd@...db.de>
Cc: Peter Zijlstra <peterz@...radead.org>, Oleg Nesterov <oleg@...hat.com>,
linux-kernel@...r.kernel.org
Subject: Re: seqlock: Cure some more scoped_seqlock() optimization fails
* Arnd Bergmann <arnd@...db.de> wrote:
> On Thu, Dec 4, 2025, at 11:43, Peter Zijlstra wrote:
> > Arnd reported an x86 randconfig using gcc-15 tripped over
> > __scoped_seqlock_bug(). Turns out GCC chose not to inline the
> > scoped_seqlock helper functions and as such was not able to optimize
> > properly.
> >
> > Reported-by: Arnd Bergmann <arnd@...db.de>
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
>
> Tested-by: Arnd Bergmann <arnd@...db.de>
>
> >
> > -static inline void __scoped_seqlock_cleanup(struct ss_tmp *sst)
> > +static __always_inline void __scoped_seqlock_cleanup(struct ss_tmp *sst)
> > {
> > if (sst->lock)
> > spin_unlock(sst->lock);
> > @@ -1252,7 +1252,7 @@ static inline void __scoped_seqlock_bug(void) { }
> > extern void __scoped_seqlock_bug(void);
> > #endif
> >
> > -static inline void
> > +static __always_inline void
> > __scoped_seqlock_next(struct ss_tmp *sst, seqlock_t *lock, enum
> > ss_state target)
> > {
> > switch (sst->state) {
>
> It looks I got close: I had tried the __always_inline on
> __scoped_seqlock_next but missed the one on __scoped_seqlock_cleanup,
> so that was not enough.
Same here, I ran into that build failure and ended up finding this
as a side-effect:
24bc5ea5c01a ("seqlock, procfs: Match scoped_seqlock_read() critical section vs. RCU ordering in do_task_stat() to do_io_accounting()")
And like you I was trying to work around the compiler failure
via forced-inlining of __scoped_seqlock_next(), but missed
__scoped_seqlock_cleanup() ... :-)
>
> Your version addresses the issue for me, thanks a lot for the fix!
Works for me too, and I've applied the fix to tip:locking/urgent.
Thanks,
Ingo
Powered by blists - more mailing lists