Re: [PATCH] futex: Fix might_sleep() warning in futex_pivot_pending()
Peter Zijlstra <[email protected]>
| Newsgroups | dev.linux.lists.syzbot,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
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.