Page MenuHomeFreeBSD

sched_ule: fix invalid tdq_slice() and slice_min
Needs ReviewPublic

Authored by mchoo on Fri, Sep 4, 5:41 PM.

Details

Reviewers
jhb
Group Reviewers
scheduler
Summary

Slice is number of ticks a thread is allowed to run, thus having slice
value of 0 shouldn't be accepted as threads will never run. In
tdq_slice(), when sched_slice > load, the function will return 0.
Similarily in sysctl.kern.ule.{quantum,slice}, if sched_slice is set
less then SCHED_SLICE_MIN_DIVISOR, sched_slice_min is computated as
zero.

For example, if a user specifies sched_slice of 4 through sysctl, then
sched_slice_min will be evaluated to 0 and tdq_slice() will return 0
when load is 5. Fix this by using imax() so sched_slice_min is always
at least 1 and tdq_slice() returns at least sched_slice_min.

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

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 76516
Build 73399: arc lint + arc unit