[rfc] bind per-cpu timeout threads to each CPU
Adrian Chadd
adrian at freebsd.org
Wed Feb 19 00:28:19 UTC 2014
Hi,
This patch binds the per-CPU timeout swi threads to the CPU they're on.
The scheduler may decide that a preempted kernel thread that's still
runnable and this can happen during things like per-CPU TCP timers
firing.
Thanks,
Index: sys/kern/kern_timeout.c
===================================================================
--- sys/kern/kern_timeout.c (revision 261910)
+++ sys/kern/kern_timeout.c (working copy)
@@ -355,6 +355,7 @@
char name[MAXCOMLEN];
#ifdef SMP
int cpu;
+ struct intr_event *ie;
#endif
cc = CC_CPU(timeout_cpu);
@@ -362,6 +363,11 @@
if (swi_add(&clk_intr_event, name, softclock, cc, SWI_CLOCK,
INTR_MPSAFE, &cc->cc_cookie))
panic("died while creating standard software ithreads");
+ if (intr_event_bind(clk_intr_event, timeout_cpu) != 0) {
+ printf("%s: timeout clock couldn't be pinned to cpu %d\n",
+ __func__,
+ timeout_cpu);
+ }
#ifdef SMP
CPU_FOREACH(cpu) {
if (cpu == timeout_cpu)
@@ -370,9 +376,15 @@
cc->cc_callout = NULL; /* Only cpu0 handles timeout(9). */
callout_cpu_init(cc);
snprintf(name, sizeof(name), "clock (%d)", cpu);
- if (swi_add(NULL, name, softclock, cc, SWI_CLOCK,
+ ie = NULL;
+ if (swi_add(&ie, name, softclock, cc, SWI_CLOCK,
INTR_MPSAFE, &cc->cc_cookie))
panic("died while creating standard software ithreads");
+ if (intr_event_bind(ie, cpu) != 0) {
+ printf("%s: per-cpu clock couldn't be pinned
to cpu %d\n",
+ __func__,
+ cpu);
+ }
}
#endif
}
-a
More information about the freebsd-arch
mailing list