Page MenuHomeFreeBSD

Reduce umtx-related work on exec and exit
ClosedPublic

Authored by mjg on May 4 2019, 10:38 PM.
Tags
None
Referenced Files
F81621907: D20160.diff
Fri, Apr 19, 3:08 AM
Unknown Object (File)
Dec 19 2023, 11:55 PM
Unknown Object (File)
Nov 9 2023, 6:22 AM
Unknown Object (File)
Oct 8 2023, 5:20 AM
Unknown Object (File)
Sep 3 2023, 1:48 AM
Unknown Object (File)
Aug 7 2023, 7:39 PM
Unknown Object (File)
Aug 7 2023, 7:39 PM
Unknown Object (File)
Aug 7 2023, 6:34 PM
Subscribers

Details

Summary

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.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/kern/kern_umtx.c
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.

  • remove proc locking in the first place
sys/kern/kern_umtx.c
4422 ↗(On Diff #57055)

I'm after avoidable locks in general. umtx shows up as a minor global lock in the grand scheme of things, I don't see what's the problem plugging it.

kib added inline comments.
sys/kern/sched_ule.c
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);
  ...
This revision is now accepted and ready to land.May 8 2019, 8:16 AM
sys/kern/sched_ule.c
1871 ↗(On Diff #57143)

I wanted to keep this easier to modify should extra code be needed in the future.

This revision was automatically updated to reflect the committed changes.