diff options
author | davidxu <davidxu@FreeBSD.org> | 2006-07-11 06:01:14 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2006-07-11 06:01:14 +0000 |
commit | 1d3b33eda596fde58e6f2ff260c3dd3efadf9f40 (patch) | |
tree | 20053c44ce808f8bc498d15af2320942e690c0c6 /sys/kern/kern_thr.c | |
parent | 0ef915a33177cd87c761106e82021560e7ef1458 (diff) | |
download | FreeBSD-src-1d3b33eda596fde58e6f2ff260c3dd3efadf9f40.zip FreeBSD-src-1d3b33eda596fde58e6f2ff260c3dd3efadf9f40.tar.gz |
For SCHED_OTHER, we always inherit current thread's interactive priority
unless current thread is realtime thread, in such case, we set a new zero
priority for it, notice we don't have per-thread nice, the priority
passed by userland is ignored here.
Diffstat (limited to 'sys/kern/kern_thr.c')
-rw-r--r-- | sys/kern/kern_thr.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/sys/kern/kern_thr.c b/sys/kern/kern_thr.c index fab27be..8110aa2 100644 --- a/sys/kern/kern_thr.c +++ b/sys/kern/kern_thr.c @@ -217,23 +217,27 @@ create_thread(struct thread *td, mcontext_t *ctx, case SCHED_FIFO: rtp.type = PRI_FIFO; rtp.prio = sched->param.sched_priority; + rtp_to_pri(&rtp, newkg); + sched_prio(newtd, newkg->kg_user_pri); break; case SCHED_RR: rtp.type = PRI_REALTIME; rtp.prio = sched->param.sched_priority; + rtp_to_pri(&rtp, newkg); + sched_prio(newtd, newkg->kg_user_pri); break; case SCHED_OTHER: - rtp.type = PRI_TIMESHARE; - if (curthread->td_ksegrp->kg_pri_class == PRI_TIMESHARE) - rtp.prio = curthread->td_ksegrp->kg_user_pri; - else + if (curthread->td_ksegrp->kg_pri_class != + PRI_TIMESHARE) { + rtp.type = PRI_TIMESHARE; rtp.prio = 0; + rtp_to_pri(&rtp, newkg); + sched_prio(newtd, newkg->kg_user_pri); + } break; default: panic("sched policy"); } - rtp_to_pri(&rtp, newkg); - sched_prio(newtd, newkg->kg_user_pri); } TD_SET_CAN_RUN(newtd); /* if ((flags & THR_SUSPENDED) == 0) */ |