Page MenuHomeFreeBSD

sched_4bsd: add static assertion for nice weight
ClosedPublic

Authored by mchoo on Fri, Sep 4, 5:36 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Sep 27, 7:56 AM
Unknown Object (File)
Sun, Sep 27, 2:19 AM
Unknown Object (File)
Sat, Sep 26, 10:31 PM
Unknown Object (File)
Fri, Sep 25, 7:51 PM
Unknown Object (File)
Fri, Sep 25, 11:30 AM
Unknown Object (File)
Thu, Sep 24, 5:21 AM
Unknown Object (File)
Sun, Sep 20, 7:28 AM
Unknown Object (File)
Sun, Sep 20, 4:47 AM
Subscribers

Details

Summary

When NICE_WEIGHT * (PRIO_MAX - PRIO_MIN) exceeds the timeshare range,
two CPU-bound threads with different nice values can have the same
priority as their nice values are clamped to the timeshare range limit.
Add static assertion on NICE_WEIGHT to ensure that there is always
enough room for nice values in the both end of the timeshare priority
range.

MFC after: 2 weeks
MFC to: stable/14, stable/15
Sponsored by: FreeBSD Foundation

Diff Detail

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

Event Timeline

mchoo requested review of this revision.Fri, Sep 4, 5:36 PM

Please rephrase though the assertion description (see inline comment).

sys/kern/sched_4bsd.c
77

I'd suggest rephrasing this to be more high-level (in general, the text should not repeat what can be readily inferred from the test itself to have enough added value).

This revision is now accepted and ready to land.Sun, Sep 6, 4:14 PM