From: Ingo Molnar <mingo@kernel.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Peter Zijlstra <peterz@infradead.org>,
Oleg Nesterov <oleg@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: seqlock: Cure some more scoped_seqlock() optimization fails
Date: Sat, 6 Dec 2025 09:50:52 +0100 [thread overview]
Message-ID: <aTPubK6cXkhhCunO@gmail.com> (raw)
In-Reply-To: <9f6a864e-f608-4543-874e-09ab034717e9@app.fastmail.com>
* Arnd Bergmann <arnd@arndb.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@arndb.de>
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
>
> Tested-by: Arnd Bergmann <arnd@arndb.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
next prev parent reply other threads:[~2025-12-06 8:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-04 10:43 seqlock: Cure some more scoped_seqlock() optimization fails Peter Zijlstra
2025-12-04 14:05 ` Arnd Bergmann
2025-12-06 8:50 ` Ingo Molnar [this message]
2025-12-06 8:52 ` Ingo Molnar
2025-12-06 8:58 ` [tip: locking/urgent] " tip-bot2 for Peter Zijlstra
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=aTPubK6cXkhhCunO@gmail.com \
--to=mingo@kernel.org \
--cc=arnd@arndb.de \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.