scheduler (sched_4bsd) questions
Stephan Uphoff
ups at tree.com
Sun Oct 3 15:43:42 PDT 2004
On Sun, 2004-10-03 at 17:39, Julian Elischer wrote:
> Stephan Uphoff wrote:
> you didn't answer this question..
>
> >
> >
> >>Where is the critical_enter that matches the extra critical_exit()
> >>you put in sched_switch()? I haven' been able to yet figure out how
> >>you don't get a double exit. but I've only looked for a few minutes.
> >
>
> ==== //depot/projects/nsched/sys/kern/sched_4bsd.c#58 -
> /home/julian/p4/nsched/sys/kern/sched_4bsd.c ====
> @@ -844,6 +844,8 @@
> if (newtd == NULL || newtd->td_ksegrp != td->td_ksegrp)
> slot_fill(td->td_ksegrp);
> }
> + critical_exit();
> + td->td_pflags &= ~TDP_OWEPREEMPT;
> }
> if (newtd) {
> /*
>
>
> where is the matching critical_enter()?
>
>From Peter's unified diff:
RCS file: /home/ncvs/src/sys/kern/sched_4bsd.c,v
retrieving revision 1.65
diff -u -r1.65 sched_4bsd.c
--- sys/kern/sched_4bsd.c 16 Sep 2004 07:12:59 -0000 1.65
+++ sys/kern/sched_4bsd.c 2 Oct 2004 14:46:29 -0000
@@ -823,6 +823,7 @@
TD_SET_CAN_RUN(td);
else {
td->td_ksegrp->kg_avail_opennings++;
+ critical_enter();
if (TD_IS_RUNNING(td)) {
/* Put us back on the run queue (kse and all).
*/
setrunqueue(td, SRQ_OURSELF|SRQ_YIELDING);
@@ -834,6 +835,8 @@
*/
slot_fill(td->td_ksegrp);
}
+ critical_exit();
+ td->td_pflags &= ~TDP_OWEPREEMPT;
}
if (newtd == NULL)
newtd = choosethread();
More information about the freebsd-arch
mailing list