Re: [RFC PATCH v2 0/6] rwsem: priority boost for holders blocking high-priority waiters
From: Kayra Cizmeci
Date: Wed Dec 02 2026 - 15:35:02 EST
On Wed, Dec 02, 2026 at 12:04:35PM -0800, Peng Huang wrote:
> On Wed, Dec 02, 2026 at 10:18:20PM +0300, Kayra Cizmeci wrote:
> > 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.
>
> Fair point, that's the main accounting difference from PE.
>
> One way to look at it: in the kernel, rwsems protect shared metadata
> (mmap_lock, i_rwsem, etc.) rather than RPCs, so the work inside the
> critical section is almost always TB's own work (like a background
> MADV_COLD or /proc read), not work done for TA. For short holds
Yeah, but the urgency of the work is coming from TA. It doesn't matter
whose work it is when we are doing the work early for TA. And we are not
demanding to do the work early, TA does.
> (within a slice), TB runs its own critical section early and pays back
> the lag when rescale_entity() restores its weight, much like rt_mutex
> PI bills the holder. For longer holds, TB actually gets the higher
> share during the hold and only pays back up to its residual lag on
> unlock (bounded within its cgroup share under FAIR_GROUP_SCHED).
>
> So TB isn't really penalized unfairly; the real trade-off is the flip
> side, that TA doesn't pay anything for bumping TB ahead of other
> runnable tasks. If you have any ideas on how to account this back to TA
> (or bound it better) without hurting down_read()/up_read(), I'd love to
> hear them!
Well accounting it for TA would be similar to reimplementing Proxy Exec,
that is why I wanted to try to do this with Proxy Exec.
I'm gonna try to sleep now. (Not a big possibility tho, I drank more coffee and
tea than I should at this point)
Anyways...
Cheers,
Kayra