From owner-svn-src-all@FreeBSD.ORG Tue Sep 21 17:37:29 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 249DD1065670; Tue, 21 Sep 2010 17:37:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 13D4F8FC14; Tue, 21 Sep 2010 17:37:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8LHbSVt001430; Tue, 21 Sep 2010 17:37:28 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8LHbSbI001428; Tue, 21 Sep 2010 17:37:28 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009211737.o8LHbSbI001428@svn.freebsd.org> From: Alexander Motin Date: Tue, 21 Sep 2010 17:37:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212970 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Sep 2010 17:37:29 -0000 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