Date: Tue, 21 Sep 2010 17:37:28 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r212970 - head/sys/kern Message-ID: <201009211737.o8LHbSbI001428@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201009211737.o8LHbSbI001428>