int ksched_getparam(register_t *ret, struct ksched *ksched, struct proc *p, struct sched_param *param) { if (RTP_PRIO_IS_REALTIME(p->p_rtprio.type)) param->sched_priority = rtpprio_to_p4prio(p->p_rtprio.prio); return 0; }
int ksched_getparam(struct ksched *ksched, struct thread *td, struct sched_param *param) { struct rtprio rtp; pri_to_rtp(td, &rtp); if (RTP_PRIO_IS_REALTIME(rtp.type)) param->sched_priority = rtpprio_to_p4prio(rtp.prio); else { if (PRI_MIN_TIMESHARE < rtp.prio) /* * The interactive score has it to min realtime * so we must show max (64 most likely */ param->sched_priority = (PRI_MAX_TIMESHARE - PRI_MIN_TIMESHARE); else param->sched_priority = tsprio_to_p4prio(rtp.prio); } return 0; }
static int swapout_procs_callback(struct proc *p, void *data) { struct lwp *lp; int action = *(int *)data; int minslp = -1; if (!swappable(p)) return(0); lwkt_gettoken(&p->p_token); /* * We only consider active processes. */ if (p->p_stat != SACTIVE && p->p_stat != SSTOP) { lwkt_reltoken(&p->p_token); return(0); } FOREACH_LWP_IN_PROC(lp, p) { /* * do not swap out a realtime process */ if (RTP_PRIO_IS_REALTIME(lp->lwp_rtprio.type)) { lwkt_reltoken(&p->p_token); return(0); } /* * Guarentee swap_idle_threshold time in memory */ if (lp->lwp_slptime < swap_idle_threshold1) { lwkt_reltoken(&p->p_token); return(0); } /* * If the system is under memory stress, or if we * are swapping idle processes >= swap_idle_threshold2, * then swap the process out. */ if (((action & VM_SWAP_NORMAL) == 0) && (((action & VM_SWAP_IDLE) == 0) || (lp->lwp_slptime < swap_idle_threshold2))) { lwkt_reltoken(&p->p_token); return(0); } if (minslp == -1 || lp->lwp_slptime < minslp) minslp = lp->lwp_slptime; } /* * If the process has been asleep for awhile, swap * it out. */ if ((action & VM_SWAP_NORMAL) || ((action & VM_SWAP_IDLE) && (minslp > swap_idle_threshold2))) { swapout(p); } /* * cleanup our reference */ lwkt_reltoken(&p->p_token); return(0); }