diff options
author | jeff <jeff@FreeBSD.org> | 2008-04-04 01:16:18 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2008-04-04 01:16:18 +0000 |
commit | 85d3ffe23c60821d6554b0426e8074b7c849762f (patch) | |
tree | b6d8a1c3cbe25318d63006459d5a7b661d49c4e7 /sys/kern/sched_ule.c | |
parent | c50de590ccc1c12087279efa95ed99508409ad6c (diff) | |
download | FreeBSD-src-85d3ffe23c60821d6554b0426e8074b7c849762f.zip FreeBSD-src-85d3ffe23c60821d6554b0426e8074b7c849762f.tar.gz |
- Allow static_boost to specify no boost with '0', traditional kernel
fixed pri boost with '1' or any priority less than the current thread's
priority with a value greater than two. Default the boost to
PRI_MIN_TIMESHARE to prevent regular user-space threads from starving
threads in the kernel. This prevents these user-threads from also
being scheduled as if they are high fixed-priority kernel threads.
- Restore the setting of lowpri in tdq_choose(). It has to be either here
or in sched_switch(). I accidentally removed it from both places.
Tested by: kris
Diffstat (limited to 'sys/kern/sched_ule.c')
-rw-r--r-- | sys/kern/sched_ule.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 9b14d0d..a1c0621 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -182,7 +182,7 @@ static int preempt_thresh = PRI_MIN_KERN; #else static int preempt_thresh = 0; #endif -static int static_boost = 1; +static int static_boost = PRI_MIN_TIMESHARE; /* * tdq - per processor runqs and statistics. All fields are protected by the @@ -1833,8 +1833,10 @@ sched_sleep(struct thread *td, int prio) td->td_slptick = ticks; if (TD_IS_SUSPENDED(td) || prio <= PSOCK) td->td_flags |= TDF_CANSWAP; - if (static_boost && prio) + if (static_boost == 1 && prio) sched_prio(td, prio); + else if (static_boost && td->td_priority > static_boost) + sched_prio(td, static_boost); } /* @@ -2138,8 +2140,10 @@ sched_choose(void) if (td) { td->td_sched->ts_ltick = ticks; tdq_runq_rem(tdq, td); + tdq->tdq_lowpri = td->td_priority; return (td); } + tdq->tdq_lowpri = PRI_MAX_IDLE; return (PCPU_GET(idlethread)); } |