DragonFly BSD
DragonFly submit List (threaded) for 2003-12
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: (set|rem)runqueue and splhigh


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 31 Dec 2003 11:23:45 -0800 (PST)

:This is a multi-part message in MIME format.
:--------------050005040308050403080504
:Content-Type: text/plain; charset=ISO-8859-15; format=flowed
:Content-Transfer-Encoding: 8bit
:
:Hi !
:
:Is it still true that (set|rem)runqueue have to be called with splhigh ?
:If yes, I have a short fix, since there are paths where they may be
:called with other masks set.
:I just bracket them in acquire_curproc and resetpriority thusly avoiding
:to chase each and every caller.
:
:I'm not sure what to do with the "broken out from setrunqueue" stuff in
:acquire_curproc either.
:
:Cheers and
:Happy New Year
:Peter

    The comment is not correct.  setrunqueue() already enters a critical
    section (see the crit_enter() and crit_exit() in setrunqueue()), which
    is equivalent to splhigh().  So the following is not needed.

					-Matt
					Matthew Dillon 
					<dillon@xxxxxxxxxxxxx>
:
:-- 
:<peter.kadau@xxxxxxxxxxxxxxxx>
:
:Campus der Max-Planck-Institute Tübingen
:Netzwerk- und Systemadministration
:
:Tel: +49 7071 601 598
:Fax: +49 7071 601 616
:
:--------------050005040308050403080504
:Content-Type: text/plain;
: name="Xrunqueue.patch"
:Content-Transfer-Encoding: 7bit
:Content-Disposition: inline;
: filename="Xrunqueue.patch"
:
:Index: kern/kern_switch.c
:===================================================================
:RCS file: /local/dragonfly/src/sys/kern/kern_switch.c,v
:retrieving revision 1.16
:diff -u -r1.16 kern_switch.c
:--- kern/kern_switch.c	30 Dec 2003 03:19:02 -0000	1.16
:+++ kern/kern_switch.c	30 Dec 2003 19:54:29 -0000
:@@ -524,6 +524,7 @@
: {
: 	int cpuid;
: 	struct proc *np;
:+	int s;
: 
: 	/*
: 	 * Short cut, we've already acquired the designation or we never
:@@ -588,7 +589,9 @@
: 		}
: 		lwkt_deschedule_self();
: 		p->p_flag &= ~P_CP_RELEASED;
:+		s = splhigh();
: 		setrunqueue(p);
:+		splx(s);
: 		lwkt_switch();	/* CPU CAN CHANGE DUE TO SETRUNQUEUE() */
: 		KASSERT((p->p_flag & (P_ONRUNQ|P_CURPROC|P_CP_RELEASED)) == P_CURPROC, ("unexpected p_flag %08x acquiring P_CURPROC\n", p->p_flag));
: 	}
:Index: kern/kern_synch.c
:===================================================================
:RCS file: /local/dragonfly/src/sys/kern/kern_synch.c,v
:retrieving revision 1.25
:diff -u -r1.25 kern_synch.c
:--- kern/kern_synch.c	17 Oct 2003 07:30:42 -0000	1.25
:+++ kern/kern_synch.c	30 Dec 2003 19:43:15 -0000
:@@ -763,6 +763,7 @@
: 	unsigned int newpriority;
: 	int opq;
: 	int npq;
:+	int s;
: 
: 	/*
: 	 * Set p_priority for general process comparisons
:@@ -795,9 +796,11 @@
: 		/*
: 		 * We have to move the process to another queue
: 		 */
:+		s = splhigh();
: 		remrunqueue(p);
: 		p->p_priority = PRIBASE_NORMAL + newpriority;
: 		setrunqueue(p);
:+		splx(s);
: 	} else {
: 		/*
: 		 * We can just adjust the priority and it will be picked
:
:--------------050005040308050403080504--
:




[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]