* Compute the priority of a process when running in user mode. * Arrange to reschedule if the resulting priority is better * than that of the current process. */
| 601 | * than that of the current process. |
| 602 | */ |
| 603 | static void |
| 604 | resetpriority(struct thread *td) |
| 605 | { |
| 606 | u_int newpriority; |
| 607 | |
| 608 | if (td->td_pri_class != PRI_TIMESHARE) |
| 609 | return; |
| 610 | newpriority = PUSER + |
| 611 | td_get_sched(td)->ts_estcpu / INVERSE_ESTCPU_WEIGHT + |
| 612 | NICE_WEIGHT * (td->td_proc->p_nice - PRIO_MIN); |
| 613 | newpriority = min(max(newpriority, PRI_MIN_TIMESHARE), |
| 614 | PRI_MAX_TIMESHARE); |
| 615 | sched_user_prio(td, newpriority); |
| 616 | } |
| 617 | |
| 618 | /* |
| 619 | * Update the thread's priority when the associated process's user |
no test coverage detected