MCPcopy Create free account
hub / github.com/F-Stack/f-stack / resetpriority

Function resetpriority

freebsd/kern/sched_4bsd.c:603–616  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

601 * than that of the current process.
602 */
603static void
604resetpriority(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

Callers 4

schedcpuFunction · 0.85
sched_clock_tickFunction · 0.85
sched_niceFunction · 0.85
sched_wakeupFunction · 0.85

Calls 4

td_get_schedFunction · 0.85
minFunction · 0.85
maxFunction · 0.85
sched_user_prioFunction · 0.70

Tested by

no test coverage detected