svn commit: r212970 - head/sys/kern
Alexander Motin
mav at FreeBSD.org
Tue Sep 21 17:37:29 UTC 2010
Author: mav
Date: Tue Sep 21 17:37:28 2010
New Revision: 212970
URL: http://svn.freebsd.org/changeset/base/212970
Log:
If new callout scheduled to another CPU and we are using global timer,
there is high probability that timer is already programmed by some other
CPU. Especially by one that registered this callout, and so active now.
Modified:
head/sys/kern/kern_clocksource.c
Modified: head/sys/kern/kern_clocksource.c
==============================================================================
--- head/sys/kern/kern_clocksource.c Tue Sep 21 17:31:14 2010 (r212969)
+++ head/sys/kern/kern_clocksource.c Tue Sep 21 17:37:28 2010 (r212970)
@@ -785,14 +785,18 @@ cpu_new_callout(int cpu, int ticks)
}
/*
* If timer is periodic - just update next event time for target CPU.
+ * If timer is global - there is chance it is already programmed.
*/
- if (periodic) {
+ if (periodic || (timer->et_flags & ET_FLAGS_PERCPU) == 0) {
state->nextevent = state->nexthard;
tmp = hardperiod;
bintime_mul(&tmp, ticks - 1);
bintime_add(&state->nextevent, &tmp);
- ET_HW_UNLOCK(state);
- return;
+ if (periodic ||
+ bintime_cmp(&state->nextevent, &nexttick, >=)) {
+ ET_HW_UNLOCK(state);
+ return;
+ }
}
/*
* Otherwise we have to wake that CPU up, as we can't get present
More information about the svn-src-head
mailing list