Page MenuHomeFreeBSD

sched: Internal priority ranges: Reduce kernel, increase timeshare
Needs ReviewPublic

Authored by olce on May 27 2024, 10:28 PM.
Tags
None
Referenced Files
F95554017: D45391.diff
Sat, Sep 21, 12:26 PM
F95463175: D45391.id139160.diff
Sat, Sep 21, 12:18 AM
F95427770: D45391.diff
Fri, Sep 20, 7:01 PM
Unknown Object (File)
Thu, Sep 19, 10:59 AM
Unknown Object (File)
Thu, Sep 19, 9:15 AM
Unknown Object (File)
Wed, Sep 18, 10:21 AM
Unknown Object (File)
Wed, Sep 18, 1:41 AM
Unknown Object (File)
Tue, Sep 17, 1:03 AM
Subscribers

Details

Reviewers
jhb
markj
mav
jeff
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 Skipped
Unit
Tests Skipped
Build Status
Buildable 59348
Build 56235: arc lint + arc unit