* Bound timeshare latency by decreasing slice size as load increases. We * consider the maximum latency as the sum of the threads waiting to run * aside from curthread and target no more than sched_slice latency but * no less than sched_slice_min runtime. */
| 575 | * no less than sched_slice_min runtime. |
| 576 | */ |
| 577 | static inline int |
| 578 | tdq_slice(struct tdq *tdq) |
| 579 | { |
| 580 | int load; |
| 581 | |
| 582 | /* |
| 583 | * It is safe to use sys_load here because this is called from |
| 584 | * contexts where timeshare threads are running and so there |
| 585 | * cannot be higher priority load in the system. |
| 586 | */ |
| 587 | load = tdq->tdq_sysload - 1; |
| 588 | if (load >= SCHED_SLICE_MIN_DIVISOR) |
| 589 | return (sched_slice_min); |
| 590 | if (load <= 1) |
| 591 | return (sched_slice); |
| 592 | return (sched_slice / load); |
| 593 | } |
| 594 | |
| 595 | /* |
| 596 | * Set lowpri to its exact value by searching the run-queue and |
no outgoing calls
no test coverage detected