Give a more reasonable CPU time to the threads which are using scheduler

activation (i.e., applications are using libpthread).  This is because
SCHED_ULE sometimes puts P_SA processes into ksq_next unnecessarily.
Which doesn't give fair amount of CPU time to processes which are
using scheduler-activation-based threads when other (semi-)CPU-intensive,
non-P_SA processes are running.

Further work will no doubt be done by jeffr at a later date.

Submitted by:	Taku YAMAMOTO <taku@cent.saitama-u.ac.jp>
Reviewed by:	rwatson, freebsd-current@
This commit is contained in:
David E. O'Brien 2004-03-21 18:53:29 +00:00
parent 2964fb6538
commit b003da7938

View file

@ -186,7 +186,7 @@ struct td_sched *thread0_sched = &td_sched;
#define SCHED_INTERACTIVE(kg) \
(sched_interact_score(kg) < SCHED_INTERACT_THRESH)
#define SCHED_CURR(kg, ke) \
(ke->ke_thread->td_priority != kg->kg_user_pri || \
(ke->ke_thread->td_priority < kg->kg_user_pri || \
SCHED_INTERACTIVE(kg))
/*
@ -1166,11 +1166,8 @@ sched_switch(struct thread *td)
*/
if ((ke->ke_flags & KEF_ASSIGNED) == 0) {
if (TD_IS_RUNNING(td)) {
if (td->td_proc->p_flag & P_SA) {
kseq_load_rem(KSEQ_CPU(ke->ke_cpu), ke);
setrunqueue(td);
} else
kseq_runq_add(KSEQ_SELF(), ke);
kseq_load_rem(KSEQ_CPU(ke->ke_cpu), ke);
setrunqueue(td);
} else {
if (ke->ke_runq) {
kseq_load_rem(KSEQ_CPU(ke->ke_cpu), ke);