I don't follow this. The last time I looked, interactivity was a percentage which was added to the nice value to get the priority; the priorities were spit between interactive and batch. Interactive levels were assigned to dedicated queues (one per priority) with the batch levels handled by a ring of queues that guaranteed batch tasks all got some time. So being interactive wasn't a purely boolean distinction because there were many levels handled in priority order.
So what does kern.sched.ule.interact actually do? And why does setting it to 0 or 100 largely turn off any impact from interactivity-scoring ?
That fair, I I did hedge with
largely turns off.
I was looking here:
https://github.com/freebsd/freebsd-...5c5ea8337054897116/sys/kern/sched_ule.c#L1753
Code:
score = imax(0, sched_interact_score(td) + nice);
if (score < sched_interact) {
[...]
} else {
If kern.sched.ule.interact is set to 0, the
score tested here will never be < 0, and it will never put in the interactive priority ranges, or use the score to adjust priority. Everything will be treated as batch, and scheduled accordingly.
If kern.sched.ule.interact is set to 100,
score will (in the absence of nice) typically be less than 100, so most user-space tasks will be put into the interactive priority ranges, and they will have a priority within the interactive range influenced by their score. A "very interactive" process won't get some of the special treatment vs. "somewhat interactive" that it would receive vs a "batch / non-interactive" process.
Basically having the threshold somewhere between 0 and 100 lets it further refine scheduling decisions to favor interactive processes, and the value relates to "just how interactive" (it may seem strange, but "sleeps more than it runs" is the sign for "interactive" as it implies
waiting for input) a process has to act to get that special treatment.
Things like "do I preempt some other task running
on a different processor to run me" are always answered "yes" if the waiting-to-be-scheduled process is interactive and the victim process is
batch.