diff options
author | davide <davide@FreeBSD.org> | 2013-03-04 11:22:19 +0000 |
---|---|---|
committer | davide <davide@FreeBSD.org> | 2013-03-04 11:22:19 +0000 |
commit | 9ad2265733ae27758ebf470fc60be9e94434b5ac (patch) | |
tree | aaf83e0c10b6cfe3059115e6dbf95f87fb79c482 | |
parent | 431035cf16837066ffdc5abc7e48a56cc1dfed5d (diff) | |
download | FreeBSD-src-9ad2265733ae27758ebf470fc60be9e94434b5ac.zip FreeBSD-src-9ad2265733ae27758ebf470fc60be9e94434b5ac.tar.gz |
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
-rw-r--r-- | sys/kern/kern_intr.c | 11 | ||||
-rw-r--r-- | sys/kern/kern_synch.c | 5 |
2 files changed, 4 insertions, 12 deletions
diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c index d2c31fd..8351ab8 100644 --- a/sys/kern/kern_intr.c +++ b/sys/kern/kern_intr.c @@ -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); + return (error); } /* diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index 73dfd70..8783142 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -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 */ |