Index: sched_ule.c =================================================================== RCS file: /home/ncvs/src/sys/kern/sched_ule.c,v retrieving revision 1.206 diff -u -r1.206 sched_ule.c --- sched_ule.c 17 Sep 2007 05:27:20 -0000 1.206 +++ sched_ule.c 21 Sep 2007 04:56:11 -0000 @@ -407,7 +407,7 @@ pri = (unsigned char)(pri - 1) % RQ_NQS; } else pri = tdq->tdq_ridx; - runq_add_pri(ts->ts_runq, ts, pri, flags); + runq_add_pri(ts->ts_runq, ts, pri, flags|SRQ_PREEMPTED); } else runq_add(ts->ts_runq, ts, flags); } @@ -639,6 +639,11 @@ move = min(move, transferable); for (i = 0; i < move; i++) tdq_move(high, low); + /* + * IPI the target cpu to force it to reschedule with the new + * workload. + */ + ipi_selected(1 << TDQ_ID(low), IPI_PREEMPT); } TDQ_UNLOCK(high); TDQ_UNLOCK(low); @@ -686,7 +691,6 @@ ts->ts_cpu = cpu; td->td_lock = TDQ_LOCKPTR(to); tdq_add(to, td, SRQ_YIELDING); - tdq_notify(ts); } /* @@ -1402,8 +1406,12 @@ * Scores greater than this are placed on the normal timeshare queue * where the priority is partially decided by the most recent cpu * utilization and the rest is decided by nice value. + * + * The nice value of the process has a linear effect on the calculated + * score. Negative nice values make it easier for a thread to be + * considered interactive. */ - score = sched_interact_score(td); + score = sched_interact_score(td) - td->td_proc->p_nice; if (score < sched_interact) { pri = PRI_MIN_REALTIME; pri += ((PRI_MAX_REALTIME - PRI_MIN_REALTIME) / sched_interact)