PERFORCE change 86239 for review
Robert Watson
rwatson at FreeBSD.org
Wed Nov 2 09:29:52 PST 2005
http://perforce.freebsd.org/chv.cgi?CH=86239
Change 86239 by rwatson at rwatson_zoo on 2005/11/02 17:29:20
When hinted not to preempt, also don't IPI.
Affected files ...
.. //depot/projects/netsmp/src/sys/kern/sched_4bsd.c#3 edit
Differences ...
==== //depot/projects/netsmp/src/sys/kern/sched_4bsd.c#3 (text+ko) ====
@@ -1159,29 +1159,40 @@
cpu = NOCPU;
ke->ke_runq = &runq;
}
-
- if (single_cpu && (cpu != PCPU_GET(cpuid))) {
- kick_other_cpu(td->td_priority,cpu);
- } else {
-
- if (!single_cpu) {
- cpumask_t me = PCPU_GET(cpumask);
- int idle = idle_cpus_mask & me;
+
+ /*
+ * Once we've established where to schedule the thread, we have to
+ * decide if we want to preempt the current thread, or IPI another
+ * CPU to start immediate execution there.
+ *
+ * Currently, suppressing preemption on the scheduling also
+ * suppresses IPIs to shedule on another CPU, as it is assumed that
+ * starting the thread running at once will result in poor timing of
+ * events, lock contention, etc.
+ */
+ if (!(flags & SRQ_NOPREEMPT)) {
+ if (single_cpu && (cpu != PCPU_GET(cpuid))) {
+ kick_other_cpu(td->td_priority,cpu);
+ } else {
+ if (!single_cpu) {
+ cpumask_t me = PCPU_GET(cpumask);
+ int idle = idle_cpus_mask & me;
- if (!idle && ((flags & SRQ_INTR) == 0) &&
- (idle_cpus_mask & ~(hlt_cpus_mask | me)))
- forwarded = forward_wakeup(cpu);
- }
+ if (!idle && ((flags & SRQ_INTR) == 0) &&
+ (idle_cpus_mask & ~(hlt_cpus_mask | me)))
+ forwarded = forward_wakeup(cpu);
+ }
- if (!forwarded) {
- if ((flags & SRQ_YIELDING) == 0 &&
- (flags & SRQ_NOPREEMPT) == 0 &&
- maybe_preempt(td))
- return;
- else
- maybe_resched(td);
+ if (!forwarded) {
+ if ((flags & SRQ_YIELDING) == 0 &&
+ maybe_preempt(td))
+ return;
+ else
+ maybe_resched(td);
+ }
}
- }
+ } else
+ maybe_resched(td);
if ((td->td_proc->p_flag & P_NOLOAD) == 0)
sched_load_add();
More information about the p4-projects
mailing list