Page MenuHomeFreeBSD

setusercontext(): Fix gap when setting a realtime-class priority
ClosedPublic

Authored by olce on May 30 2023, 5:48 PM.
Tags
None
Referenced Files
F143325617: D40339.id122624.diff
Wed, Jan 28, 10:32 PM
F143295677: D40339.id128109.diff
Wed, Jan 28, 2:02 PM
F143290547: D40339.id122657.diff
Wed, Jan 28, 12:33 PM
Unknown Object (File)
Wed, Jan 28, 2:47 AM
Unknown Object (File)
Tue, Jan 27, 12:25 PM
Unknown Object (File)
Thu, Jan 22, 5:53 AM
Unknown Object (File)
Fri, Jan 9, 4:27 PM
Unknown Object (File)
Wed, Jan 7, 9:38 AM

Details

Summary

The login.conf's "priority" capability allows to set priorities in the idle or
realtime classes in addition to the classical nice values (-20 to 20), through
a natural extension where values greater than 20 put the processes in the idle
class (with priority adjusted within RTP_PRIO_MIN and RTP_PRIO_MAX, 21 being
converted to 0, 22 to 1, etc.) and values lower than -20 put the process in the
realtime class (with priority adjusted within RTP_PRIO_MIN and RTP_PRIO_MAX, -21
being converted to RTP_PRIO_MAX (31), -22 to 30, etc.).

Before this fix, in the latter case (realtime class), -21 was converted to 30,
and RTP_PRIO_MAX (31) could never be specified.

While here, change the priority computation for the idle-class case to be
symmetrical and use RTP_PRIO_MIN (in practice, this changes nothing at all,
since RTP_PRIO_MIN is 0; but this is the correct theoretical formula, which
would work as well with other values of RTP_PRIO_MIN).

PR: 271727

Test Plan

Test locally.

Diff Detail

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

Event Timeline

olce requested review of this revision.May 30 2023, 5:48 PM

Original commit, with message untweaked by arc

This revision is now accepted and ready to land.Jun 6 2023, 1:33 PM