Date: Wed, 15 Sep 2004 05:15:44 GMT From: Julian Elischer <julian@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 61527 for review Message-ID: <200409150515.i8F5FiGe066084@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=61527 Change 61527 by julian@julian_ref on 2004/09/15 05:15:06 more careful counting of slots Affected files ... .. //depot/projects/nsched/sys/kern/kern_switch.c#30 edit .. //depot/projects/nsched/sys/kern/sched_4bsd.c#55 edit .. //depot/projects/nsched/sys/kern/sched_ule.c#34 edit Differences ... ==== //depot/projects/nsched/sys/kern/kern_switch.c#30 (text+ko) ==== @@ -266,7 +266,6 @@ */ if (td) { kg->kg_last_assigned = td; - kg->kg_avail_opennings--; sched_add(td, SRQ_BORING); CTR2(KTR_RUNQ, "slot_fill: td%p -> kg%p", td, kg); } else { @@ -301,7 +300,6 @@ if ((td->td_proc->p_flag & P_HADTHREADS) == 0) { /* remve from sys run queue and free up a slot */ sched_rem(td); - kg->kg_avail_opennings++; ke->ke_state = KES_THREAD; return; } @@ -316,7 +314,6 @@ * see if we need to move the KSE in the run queues. */ sched_rem(td); - kg->kg_avail_opennings++; ke->ke_state = KES_THREAD; td2 = kg->kg_last_assigned; KASSERT((td2 != NULL), ("last assigned has wrong value")); @@ -361,7 +358,6 @@ TAILQ_PREV(td, threadqueue, td_runq); } sched_rem(td); - kg->kg_avail_opennings++; } TAILQ_REMOVE(&kg->kg_runq, td, td_runq); kg->kg_runnable--; ==== //depot/projects/nsched/sys/kern/sched_4bsd.c#55 (text+ko) ==== @@ -792,6 +792,12 @@ /* * The thread we are about to run needs to be counted as if it had been * added to the run queue and selected. + * it came from: + * A preemption + * An upcall + * A followon + * Do this before saving curthread so that the slot count + * doesn't give an overly optimistic view when that happens. */ if (newtd) { KASSERT((newtd->td_inhibitors == 0), @@ -1045,12 +1051,17 @@ if ((td->td_proc->p_flag & P_NOLOAD) == 0) sched_tdcnt--; + td->td_ksegrp->kg_avail_opennings++; runq_remove(ke->ke_runq, ke); ke->ke_state = KES_THREAD; - ke->ke_ksegrp->kg_runq_kses--; + td->td_ksegrp->kg_runq_kses--; } +/* + * Select threads to run. + * Notice that the running threads still consume a slot. + */ struct kse * sched_choose(void) { ==== //depot/projects/nsched/sys/kern/sched_ule.c#34 (text+ko) ==== @@ -1801,6 +1801,7 @@ ("sched_rem: KSE not on run queue")); ke->ke_state = KES_THREAD; + td->td_ksegrp->kg_avail_opennings++; ke->ke_ksegrp->kg_runq_threads--; kseq = KSEQ_CPU(ke->ke_cpu); kseq_runq_rem(kseq, ke);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200409150515.i8F5FiGe066084>