chooseproc cpu affinity question
Matthew Dillon
dillon at apollo.backplane.com
Wed Jan 14 13:07:27 PST 2004
: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 at 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 at xxxxxxxxxxxxxxxx>
:
:Campus der Max-Planck-Institute Tübingen
:Netzwerk- und Systemadministration
:
:Tel: +49 7071 601 598
:Fax: +49 7071 601 616
More information about the Kernel
mailing list