From: Peter Zijlstra <peterz@infradead.org>
To: Yao Kai <yaokai34@huawei.com>
Cc: syzbot <syzbot@kernel.org>,
syzkaller-bugs@googlegroups.com, linux-kernel@vger.kernel.org,
Ingo Molnar <mingo@redhat.com>, Thomas Gleixner <tglx@kernel.org>,
andrealmeid@igalia.com, dave@stgolabs.net, dvhart@infradead.org,
liuyongqiang13@huawei.com, syzbot@lists.linux.dev
Subject: Re: [PATCH] futex: Fix might_sleep() warning in futex_pivot_pending()
Date: Thu, 20 Aug 2026 09:35:18 +0200 [thread overview]
Message-ID: <20260820073518.GM1247881@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <2247c7e0-1466-4228-900c-c5b0677fba41@huawei.com>
On Thu, Aug 20, 2026 at 03:32:17PM +0800, Yao Kai wrote:
> > I still think we should use smp_mb() here, smp_mb__after_spinlock() only
> > orders accesses preceding the lock acquisition against later accesses. The
> > waitqueue insertion happens after that acquisition, so I don't think
> > smp_mb__after_spinlock() covers it here.
> >
>
> On further thought, please disregard my previous objection to
> smp_mb__after_spinlock().
>
> I was considering the documented semantics of
> smp_mb__after_spinlock() in isolation and overlooked that the full
> waiter-side sequence also includes the subsequent mutex acquisition in
> futex_pivot_pending():
>
> STORE waitqueue entry
> UNLOCK wq_head->lock
> smp_mb__after_spinlock()
> LOCK mmph->lock
> LOAD refcount
>
> On architectures where the UNLOCK+LOCK sequence needs strengthening,
> smp_mb__after_spinlock() provides the required full barrier. On
> architectures where it is a no-op, the lock acquisition is already
> strong enough to provide the required ordering.
>
> So your version looks sufficient. Sorry for the noise.
No problem.
next prev parent reply other threads:[~2026-08-20 7:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-13 6:50 [PATCH] futex: Fix might_sleep() warning in futex_pivot_pending() syzbot
2026-08-14 13:38 ` Peter Zijlstra
2026-08-17 7:29 ` Yao Kai
2026-08-18 10:46 ` Peter Zijlstra
2026-08-18 12:24 ` Yao Kai
2026-08-20 7:32 ` Yao Kai
2026-08-20 7:35 ` Peter Zijlstra [this message]
2026-08-20 7:33 ` Peter Zijlstra
-- strict thread matches above, loose matches on Subject: below --
2026-08-20 7:49 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=20260820073518.GM1247881@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=andrealmeid@igalia.com \
--cc=dave@stgolabs.net \
--cc=dvhart@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liuyongqiang13@huawei.com \
--cc=mingo@redhat.com \
--cc=syzbot@kernel.org \
--cc=syzbot@lists.linux.dev \
--cc=syzkaller-bugs@googlegroups.com \
--cc=tglx@kernel.org \
--cc=yaokai34@huawei.com \
/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.