DragonFly BSD
DragonFly kernel List (threaded) for 2004-01
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: chooseproc cpu affinity question


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 14 Jan 2004 13:07:10 -0800 (PST)

:Hi !
:
:I'm still on my way refactoring some of kern_switch.c and friends
:and stumbled across this (IMHO) oddity.
:
:Just wondering whether the check-only-for-the-next-one was intended...

    Yes, the check for only the next one is intended.  Putting a iterative
    loop in the middle of the process selection code's critical path is
    not very condusive to performance.

					-Matt
					Matthew Dillon 
					<dillon@xxxxxxxxxxxxx>

: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  14 Jan 2004 20:33:21 -0000
:@@ -171,13 +171,13 @@
:          * This is a fallback check, setrunqueue() tries to wakeup the
:          * correct cpu and is our front-line affinity.
:          */
:-       if (p->p_thread->td_gd != mycpu &&
:-           (chkp = TAILQ_NEXT(p, p_procq)) != NULL
:-       ) {
:-               if (chkp->p_thread->td_gd == mycpu) {
:-                       ++choose_affinity;
:-                       p = chkp;
:-               }
:+       TAILQ_FOREACH(chkp, q, p_procq) {
:+               if (chkp->p_thread->td_gd == mycpu)
:+                       break;
:+       }
:+       if (p != chkp && TAILQ_NEXT(chkp, p_procq)) {
:+               ++choose_affinity;
:+               p = chkp;
:         }
:  #endif
:
:Cheers
:Peter
:
:-- 
:<peter.kadau@xxxxxxxxxxxxxxxx>
:
:Campus der Max-Planck-Institute Tübingen
:Netzwerk- und Systemadministration
:
:Tel: +49 7071 601 598
:Fax: +49 7071 601 616




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