From owner-svn-src-all@FreeBSD.ORG Tue Nov 24 19:57:41 2009 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 CA86F10656A3; Tue, 24 Nov 2009 19:57:41 +0000 (UTC) (envelope-from ivoras@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BA1DB8FC0C; Tue, 24 Nov 2009 19:57:41 +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 nAOJvfi4028108; Tue, 24 Nov 2009 19:57:41 GMT (envelope-from ivoras@svn.freebsd.org) Received: (from ivoras@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAOJvfuw028106; Tue, 24 Nov 2009 19:57:41 GMT (envelope-from ivoras@svn.freebsd.org) Message-Id: <200911241957.nAOJvfuw028106@svn.freebsd.org> From: Ivan Voras Date: Tue, 24 Nov 2009 19:57:41 +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: r199764 - 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, 24 Nov 2009 19:57:41 -0000 Author: ivoras Date: Tue Nov 24 19:57:41 2009 New Revision: 199764 URL: http://svn.freebsd.org/changeset/base/199764 Log: Make ULE process usage (%CPU) accounting usable again by keeping track of the last tick we incremented on. Submitted by: matthew.fleming/at/isilon.com, is/at/rambler-co.ru Reviewed by: jeff (who thinks there should be a better way in the future) Approved by: gnn (mentor) MFC after: 3 weeks Modified: head/sys/kern/sched_ule.c Modified: head/sys/kern/sched_ule.c ============================================================================== --- head/sys/kern/sched_ule.c Tue Nov 24 19:26:53 2009 (r199763) +++ head/sys/kern/sched_ule.c Tue Nov 24 19:57:41 2009 (r199764) @@ -103,6 +103,7 @@ struct td_sched { u_int ts_slptime; /* Number of ticks we vol. slept */ u_int ts_runtime; /* Number of ticks we were running */ int ts_ltick; /* Last tick that we were running on */ + int ts_incrtick; /* Last tick that we incremented on */ int ts_ftick; /* First tick that we were running on */ int ts_ticks; /* Tick count */ #ifdef KTR @@ -1991,6 +1992,7 @@ sched_fork_thread(struct thread *td, str */ ts2->ts_ticks = ts->ts_ticks; ts2->ts_ltick = ts->ts_ltick; + ts2->ts_incrtick = ts->ts_incrtick; ts2->ts_ftick = ts->ts_ftick; child->td_user_pri = td->td_user_pri; child->td_base_user_pri = td->td_base_user_pri; @@ -2182,11 +2184,12 @@ sched_tick(void) * Ticks is updated asynchronously on a single cpu. Check here to * avoid incrementing ts_ticks multiple times in a single tick. */ - if (ts->ts_ltick == ticks) + if (ts->ts_incrtick == ticks) return; /* Adjust ticks for pctcpu */ ts->ts_ticks += 1 << SCHED_TICK_SHIFT; ts->ts_ltick = ticks; + ts->ts_incrtick = ticks; /* * Update if we've exceeded our desired tick threshhold by over one * second.