Re: [RFC PATCH v2 0/6] rwsem: priority boost for holders blocking high-priority waiters

From: Peng Huang

Date: Wed Dec 02 2026 - 15:04:42 EST


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
(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!

Thanks,
Peng