On Wed, Aug 5, 2020 at 10:21 PM Hugh Dickins wrote: > > Something I was interested to realize in looking at this: trylock_page() > on a contended lock is now much less likely to jump the queue and > succeed than before, since your lock holder hands off the page lock to > the next holder: much smaller window than waiting for the next to wake > to take it. Nothing wrong with that, but effect might be seen somewhere. Yeah, the window is smaller, but it's not gone. It *might* be interesting to actually do the handover directly from "unlock_page()", and avoid clearing (and then setting) the bit entirely. Something like the attached TOTALLY UNTESTED patch. NOTE! Sometimes when I say something is untested, I think the patch is fine because it's simple and straightforward, I just didn't test it. This time it's both untested and very very subtle indeed. Did I get the hand-over case SMP memory barriers right? Did I screw something else up? So this might be complete garbage. I really don't know. But it might close the window for an unfair trylock (or lucky page_lock()) entirely. Or maybe it just makes page locking break entirely. It's a very real risk. The upside may not be worth it. Linus