- 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
This commit is contained in:
Attilio Rao 2010-01-08 14:55:11 +00:00
parent a095a78a13
commit 6eac7e5752
2 changed files with 2 additions and 2 deletions

View File

@ -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);
}

View File

@ -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. */