Page MenuHomeFreeBSD

sched: Internal priority ranges: Reduce kernel, increase timeshare
ClosedPublic

Authored by olce on May 27 2024, 10:28 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Jul 6, 5:45 PM
Unknown Object (File)
Sat, Jul 5, 7:19 PM
Unknown Object (File)
Mon, Jun 30, 12:24 PM
Unknown Object (File)
Mon, Jun 30, 8:22 AM
Unknown Object (File)
Sun, Jun 29, 6:16 PM
Unknown Object (File)
Sun, Jun 29, 2:26 PM
Unknown Object (File)
Thu, Jun 19, 4:47 AM
Unknown Object (File)
Wed, Jun 18, 8:04 AM
Subscribers

Details

Summary

Please see overview of project at D45393.

Now that a difference of 1 in priority level is significant, we can
shrink the priority range reserved for kernel threads.

Only four distinct levels are necessary for the bottom half (3 base
levels and arguably an additional one for demoted interrupt threads that
run for full time slices so that they finally don't compete with other
ones). To leave room for other possible uses, we settle on 8 levels.

Given the symbolic constants for the top half, 10 levels are currently
necessary. We settle on 16 levels.

This allows to enlarge the timesharing range, which covers ULE's both
interactive and batch range, to 168 distinct levels from less than 64
ones for ULE (as of before the changes to make it use a single runqueue
and have 256 distinct levels per runqueue) and 34 ones for 4BSD.

While here, note that the realtime range is required to have at least 32
priority levels since:

  • POSIX mandates at least 32 distinct levels for the SCHED_RR/SCHED_FIFO scheduling policies.
  • We directly map contiguous priority levels ('sched_priority') of these scheduling policies to distinct, contiguous internal priority levels.

Conversely, having at least 32 priority levels is enough to guarantee
compliance to the POSIX requirement mentioned above because different
internal priority levels are treated differently since commit "runq:
Switch to 256 levels".

While here, list explicit change restrictions for the realtime and idle
range.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

olce requested review of this revision.May 27 2024, 10:28 PM
olce edited the summary of this revision. (Show Details)

Rebase.

This revision was not accepted when it landed; it landed in state Needs Review.Wed, Jun 18, 2:14 AM
This revision was automatically updated to reflect the committed changes.