From owner-svn-src-projects@FreeBSD.ORG Wed Feb 27 19:49:15 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7DFBF4B8; Wed, 27 Feb 2013 19:49:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 59F80A65; Wed, 27 Feb 2013 19:49:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r1RJnFm4079831; Wed, 27 Feb 2013 19:49:15 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r1RJnFle079830; Wed, 27 Feb 2013 19:49:15 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201302271949.r1RJnFle079830@svn.freebsd.org> From: Alexander Motin Date: Wed, 27 Feb 2013 19:49:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r247410 - projects/calloutng/sys/kern X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Feb 2013 19:49:15 -0000 Author: mav Date: Wed Feb 27 19:49:14 2013 New Revision: 247410 URL: http://svnweb.freebsd.org/changeset/base/247410 Log: Remove some comparisons by using INT64_MAX instead of -1 for unset times. Modified: projects/calloutng/sys/kern/kern_clocksource.c Modified: projects/calloutng/sys/kern/kern_clocksource.c ============================================================================== --- projects/calloutng/sys/kern/kern_clocksource.c Wed Feb 27 19:38:33 2013 (r247409) +++ projects/calloutng/sys/kern/kern_clocksource.c Wed Feb 27 19:49:14 2013 (r247410) @@ -221,16 +221,14 @@ handleevents(sbintime_t now, int fake) } } else state->nextprof = state->nextstat; - if (now >= state->nextcallopt && state->nextcallopt != -1) { - state->nextcall = -1; - state->nextcallopt = -1; + if (now >= state->nextcallopt) { + state->nextcall = state->nextcallopt = INT64_MAX; callout_process(now); } #ifdef KDTRACE_HOOKS - if (fake == 0 && cyclic_clock_func != NULL && - state->nextcyc != -1 && now >= state->nextcyc) { - state->nextcyc = -1; + if (fake == 0 && now >= state->nextcyc && cyclic_clock_func != NULL) { + state->nextcyc = INT64_MAX; (*cyclic_clock_func)(frame); } #endif @@ -271,7 +269,7 @@ getnextcpuevent(int idle) event += tick_sbt * (hardfreq - 1); } /* Handle callout events. */ - if (state->nextcall != -1 && event > state->nextcall) + if (event > state->nextcall) event = state->nextcall; if (!idle) { /* If CPU is active - handle other types of events. */ if (event > state->nextstat) @@ -280,7 +278,7 @@ getnextcpuevent(int idle) event = state->nextprof; } #ifdef KDTRACE_HOOKS - if (state->nextcyc != -1 && event > state->nextcyc) + if (event > state->nextcyc) event = state->nextcyc; #endif return (event); @@ -603,10 +601,10 @@ cpu_initclocks_bsp(void) state = DPCPU_ID_PTR(cpu, timerstate); mtx_init(&state->et_hw_mtx, "et_hw_mtx", NULL, MTX_SPIN); #ifdef KDTRACE_HOOKS - state->nextcyc = -1; + state->nextcyc = INT64_MAX; #endif - state->nextcall = -1; - state->nextcallopt = -1; + state->nextcall = INT64_MAX; + state->nextcallopt = INT64_MAX; } periodic = want_periodic; /* Grab requested timer or the best of present. */ @@ -831,11 +829,11 @@ clocksource_cyc_set(const struct bintime return; } state->nextcyc = t; - if (state->nextcyc >= state->nextevent) { + if (t >= state->nextevent) { ET_HW_UNLOCK(state); return; } - state->nextevent = state->nextcyc; + state->nextevent = t; if (!periodic) loadtimer(now, 0); ET_HW_UNLOCK(state); @@ -865,17 +863,17 @@ cpu_new_callout(int cpu, sbintime_t bt, * and scheduling. */ state->nextcallopt = bt_opt; - if (state->nextcall != -1 && bt >= state->nextcall) { + if (bt >= state->nextcall) { ET_HW_UNLOCK(state); return; } state->nextcall = bt; - /* If there is some some other event set earlier -- do nothing. */ - if (state->nextcall >= state->nextevent) { + /* If there is some other event set earlier -- do nothing. */ + if (bt >= state->nextevent) { ET_HW_UNLOCK(state); return; } - state->nextevent = state->nextcall; + state->nextevent = bt; /* If timer is periodic -- there is nothing to reprogram. */ if (periodic) { ET_HW_UNLOCK(state);