From owner-svn-src-head@FreeBSD.ORG Fri Jan 8 14:55:11 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5FE45106566C; Fri, 8 Jan 2010 14:55:11 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4E12E8FC0A; Fri, 8 Jan 2010 14:55:11 +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 o08EtBw9004347; Fri, 8 Jan 2010 14:55:11 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o08EtB0b004344; Fri, 8 Jan 2010 14:55:11 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201001081455.o08EtB0b004344@svn.freebsd.org> From: Attilio Rao Date: Fri, 8 Jan 2010 14:55:11 +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: r201790 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2010 14:55:11 -0000 Author: attilio Date: Fri Jan 8 14:55:11 2010 New Revision: 201790 URL: http://svn.freebsd.org/changeset/base/201790 Log: - Fix a bug in sched_4bsd where the timestamp for the sleeping operation is not cleaned up on the wakeup but reset. This is harmless mostly because td_slptick (and ki_slptime from userland) should be analyzed only with the assumption that the thread is actually sleeping (thus while the td_slptick is correctly set) but without this invariant the number is nomore consistent. - Move td_slptick from u_int to int in order to follow 'ticks' signedness and wrap up accordingly [0] [0] Submitted by: emaste Sponsored by: Sandvine Incorporated MFC 1 week Modified: head/sys/kern/sched_4bsd.c head/sys/sys/proc.h Modified: head/sys/kern/sched_4bsd.c ============================================================================== --- head/sys/kern/sched_4bsd.c Fri Jan 8 14:55:10 2010 (r201789) +++ head/sys/kern/sched_4bsd.c Fri Jan 8 14:55:11 2010 (r201790) @@ -1050,7 +1050,7 @@ sched_wakeup(struct thread *td) updatepri(td); resetpriority(td); } - td->td_slptick = ticks; + td->td_slptick = 0; ts->ts_slptime = 0; sched_add(td, SRQ_BORING); } Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Fri Jan 8 14:55:10 2010 (r201789) +++ head/sys/sys/proc.h Fri Jan 8 14:55:11 2010 (r201790) @@ -217,7 +217,7 @@ struct thread { int td_pinned; /* (k) Temporary cpu pin count. */ struct ucred *td_ucred; /* (k) Reference to credentials. */ u_int td_estcpu; /* (t) estimated cpu utilization */ - u_int td_slptick; /* (t) Time at sleep. */ + int td_slptick; /* (t) Time at sleep. */ struct rusage td_ru; /* (t) rusage information */ uint64_t td_incruntime; /* (t) Cpu ticks to transfer to proc. */ uint64_t td_runtime; /* (t) How many cpu ticks we've run. */