MFcalloutng (r244355):

Make loadavg calculation callout direct. There are several reasons for it:
 - it is very simple and doesn't worth context switch to SWI;
 - since SWI is no longer used here, we can remove twelve years old hack,
excluding this SWI from from the loadavg statistics;
 - it fixes problem when eventtimer (HPET) shares interrupt with some other
device, and that interrupt thread counted as permanent loadavg of 1; now
loadavg accounted before that interrupt thread is scheduled.

Sponsored by:	Google Summer of Code 2012, iXsystems inc.
Tested by:	flo, marius, ian, Fabian Keil, markj
This commit is contained in:
Davide Italiano 2013-03-04 11:22:19 +00:00
parent 5b999a6be0
commit dbd2e1677f
2 changed files with 4 additions and 12 deletions

View File

@ -1103,7 +1103,6 @@ int
swi_add(struct intr_event **eventp, const char *name, driver_intr_t handler,
void *arg, int pri, enum intr_type flags, void **cookiep)
{
struct thread *td;
struct intr_event *ie;
int error;
@ -1125,15 +1124,7 @@ swi_add(struct intr_event **eventp, const char *name, driver_intr_t handler,
}
error = intr_event_add_handler(ie, name, NULL, handler, arg,
PI_SWI(pri), flags, cookiep);
if (error)
return (error);
if (pri == SWI_CLOCK) {
td = ie->ie_thread->it_thread;
thread_lock(td);
td->td_flags |= TDF_NOLOAD;
thread_unlock(td);
}
return (0);
}
/*

View File

@ -560,8 +560,9 @@ loadav(void *arg)
* random variation to avoid synchronisation with processes that
* run at regular intervals.
*/
callout_reset(&loadav_callout, hz * 4 + (int)(random() % (hz * 2 + 1)),
loadav, NULL);
callout_reset_sbt(&loadav_callout,
tick_sbt * (hz * 4 + (int)(random() % (hz * 2 + 1))), 0,
loadav, NULL, C_DIRECT_EXEC | C_HARDCLOCK);
}
/* ARGSUSED */