Vast majority of the time there is no need to do anything. The patch below avoids relocking proc and locking umtx + thread lock in the common case.
|4422 ↗||(On Diff #57055)|
So your problem is this PROC_UNLOCK() ?
I think it can be done much simpler. Since the process is single-threaded, its thread list must be stable there and you can avoid acquiring the PROC_LOCK() in umtx_exec_hook at all.
Of course the proper comment is due.
|1871 ↗||(On Diff #57143)|
Why not write this part as
if (td->td_lend_user_pri == prio || td->td_user_pri == min(prio, td->td_base_user_pri) || td->td_priority < td->td_user_pri) return; thread_lock(td); ...