On Sat, Sep 12, 2020 at 1:59 PM James Bottomley <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx> wrote: > > On Sat, 2020-09-12 at 10:59 -0700, Linus Torvalds wrote: > [...] > > Any other suggestions than those (a)-(d) ones above? > > What about revert and try to fix the outliers? Say by having a timer > set when a process gets put to sleep waiting on the page lock. No timer needed, I suspect. I tried to code something like this up yesterday (hjmm. Thursday?) as a "hybrid" scheme, where we'd start out with the old behavior and let people unfairly get the lock while there were waiters, but when a waiter woke up and noticed that it still couldn't get the lock, _then_ it would stat using the new scheme. So still be unfair for a bit, but limit the unfairness so that a waiter won't lose the lock more than once (but obviously while the waiter initially slept, _many_ other lockers could have come through). I ended up with a code mess and gave up on it (it seemed to just get all the complications from the old _and_ the new model), but maybe I should try again now that I know what went wrong last time. I think I tried too hard to actually mix the old and the new code. (If I tried again, I'd not try to mix the new and the old code, I'd make the new one start out with a non-exclusive wait - which the code already supports for that whole "wait for PG_writeback to end" as opposed to "wait to take PG_lock" - and then turn it into an exclusive wait if it fails.. That might work out better and not mix entirely different approaches). Linus