|
Description
|
The change is made as part of 6327235 CPU caps.
The CPU caps project implementation uses the following piece of code:
void
cap_thread_charge(kthread_t *t, hrtime_t *total_cpu, short *new_ticks)
{
uint64_t new_usage = mstate_thread_onproc_time(t);
ASSERT3U(new_usage, >=, old_usage);
...
The ASSERT above triggers once in a while.
Extra debugging info was added (such as saving previous results, including all of per-state
microstate buckets along with scaled and unscaled aggregations). It wasn't
enough to figure out what is going on. There are two possibilities -
(a) gethrtime_unscaled can return values going backwards (quick code
inspection shows that it is possible, on x86 at least); or (b) there is
a problem with how microstate accounting is done -- that is, we might be
doing syscall_mstate() transition from LMS_USER to LMS_SYSTEM, when we're
currently in LMS_SLEEP (or any other state, other than LMS_USER/SYSTEM/TRAP)
according to t->t_mstate. See mstate_thread_onproc_time() in msacct.c
for details.
There is a bunch of dispatcher code compiled with #ifdef KSLICE. This code is not used and should be removed.
|