Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Oct 2009 20:24:07 +0900
From:      Taku YAMAMOTO <taku@tackymt.homeip.net>
To:        freebsd-current@freebsd.org
Subject:   softclock swis not bound to specific cpu
Message-ID:  <20091018202407.656c3863.taku@tackymt.homeip.net>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.

--Multipart=_Sun__18_Oct_2009_20_24_07_+0900_=nzbFP2nWWLmx7ap
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

I noticed that the softclock threads didn't seem to be bound to any cpu.

I'm not sure whether it's the Right Thing (TM) to bind them to the
corresponding cpus though: it might be good to give the scheduler a chance
to rebalance callouts.

I'm about to test the modification like the attached diff.
Comments are welcome.

-- 
-|-__   YAMAMOTO, Taku
 | __ <     <taku@tackymt.homeip.net>

      - A chicken is an egg's way of producing more eggs. -

--Multipart=_Sun__18_Oct_2009_20_24_07_+0900_=nzbFP2nWWLmx7ap
Content-Type: text/x-diff;
 name="softclock_bind.diff"
Content-Disposition: attachment;
 filename="softclock_bind.diff"
Content-Transfer-Encoding: 7bit

--- sys/kern/kern_timeout.c.orig	2009-09-25 09:42:55.007102687 +0900
+++ sys/kern/kern_timeout.c	2009-10-18 19:47:15.537282684 +0900
@@ -201,6 +201,7 @@ start_softclock(void *dummy)
 {
 	struct callout_cpu *cc;
 #ifdef SMP
+	struct intr_event *ie;	/* This can be a member of callout_cpu. */
 	int cpu;
 #endif
 
@@ -210,13 +211,15 @@ start_softclock(void *dummy)
 		panic("died while creating standard software ithreads");
 	cc->cc_cookie = softclock_ih;
 #ifdef SMP
+	intr_event_bind(clk_intr_event, timeout_cpu);
 	for (cpu = 0; cpu <= mp_maxid; cpu++) {
 		if (cpu == timeout_cpu)
 			continue;
 		if (CPU_ABSENT(cpu))
 			continue;
 		cc = CC_CPU(cpu);
-		if (swi_add(NULL, "clock", softclock, cc, SWI_CLOCK,
+		ie = NULL;
+		if (swi_add(&ie, "clock", softclock, cc, SWI_CLOCK,
 		    INTR_MPSAFE, &cc->cc_cookie))
 			panic("died while creating standard software ithreads");
 		cc->cc_callout = NULL;	/* Only cpu0 handles timeout(). */
@@ -224,6 +227,7 @@ start_softclock(void *dummy)
 		    sizeof(struct callout_tailq) * callwheelsize, M_CALLOUT,
 		    M_WAITOK);
 		callout_cpu_init(cc);
+		intr_event_bind(ie, cpu);
 	}
 #endif
 }

--Multipart=_Sun__18_Oct_2009_20_24_07_+0900_=nzbFP2nWWLmx7ap--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20091018202407.656c3863.taku>