summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/kern/sched_ule.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c
index 0340a35cf9dd..36c54b3d4e31 100644
--- a/sys/kern/sched_ule.c
+++ b/sys/kern/sched_ule.c
@@ -101,6 +101,7 @@ struct td_sched {
u_int ts_runtime; /* Number of ticks we were running */
/* The following variables are only used for pctcpu calculation */
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 SMP
@@ -2075,6 +2076,7 @@ sched_fork_thread(struct thread *td, struct thread *child)
*/
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;
@@ -2266,10 +2268,11 @@ 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_incrtick = ticks;
ts->ts_ltick = ticks;
/*
* Update if we've exceeded our desired tick threshhold by over one