Re: [RFC PATCH v2 0/6] rwsem: priority boost for holders blocking high-priority waiters
From: Kayra Cizmeci
Date: Wed Dec 02 2026 - 14:18:29 EST
On Wed, Dec 02, 2026 at 09:49:12AM -0800, Peng Huang wrote:
> On Wed, Dec 02, 2026 at 07:39:16PM +0300, Kayra Cizmeci wrote:
> > Can't we select one of the readers as the owner?
>
> I thought about that too, and ran into two things:
>
> With a single reader slot, overlapping readers slip through: if reader A
> takes the slot and reader B enters while it's taken, once A unlocks B is
> still blocking the writer with no owner recorded. We'd also need extra
> sync in up_read() so the owner task can't exit under PE.
>
> Keeping a full reader list on the rwsem lets us hand off to the next
> reader, but puts lock/list contention on every down_read()/up_read().
>
> Happy to hear if you have a cleaner way around that!
Nah, I don't. But then I'm not so optimistic about all this... :-(.
Look here:
TA waits on the lock that TB holds. TB has a weight of 1, while TA has a
weight of 99.
Now TA wants to run early, so it needs to donate some of its time to
TB so that TB finishes its job earlier and TA runs earlier.
But you just raise TB's weight to TA's. So now there is a problem, no?:
TB runs on TA's donation (weight) but TA doesn't pay anything
to make the donation. Normally on Proxy Exec, TA would pay the bill.
While here, TB does. TB is running early because TA wanted to run early,
and TA was waiting for it. If TA didn't waited TB there is no reason for
TB to run early. IMO, it doesn't makes sense that TA is the only one
demanding this, and TB is the one paying the bill.
Thanks,
Kayra