Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Jan 2010 14:55:11 +0000 (UTC)
From:      Attilio Rao <attilio@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r201790 - in head/sys: kern sys
Message-ID:  <201001081455.o08EtB0b004344@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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. */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001081455.o08EtB0b004344>