- Move FSCALE back to kern_sync. This is not scheduler specific.

- Create a new callout for lbolt and move it out of schedcpu().  This is not
   scheduler specific either.

Approved by:	re
This commit is contained in:
Jeff Roberson 2002-11-21 08:57:08 +00:00
parent c55ae80a58
commit 148302c9c9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=107134
2 changed files with 15 additions and 5 deletions

View file

@ -75,6 +75,7 @@ int hogticks;
int lbolt;
static struct callout loadav_callout;
static struct callout lbolt_callout;
struct loadavg averunnable =
{ {0, 0, 0}, FSCALE }; /* load average, of runnable procs */
@ -88,8 +89,13 @@ static fixpt_t cexp[3] = {
0.9944598480048967 * FSCALE, /* exp(-1/180) */
};
/* kernel uses `FSCALE', userland (SHOULD) use kern.fscale */
static int fscale __unused = FSCALE;
SYSCTL_INT(_kern, OID_AUTO, fscale, CTLFLAG_RD, 0, FSCALE, "");
static void endtsleep(void *);
static void loadav(void *arg);
static void lboltcb(void *arg);
/*
* We're only looking at 7 bits of the address; everything is
@ -625,15 +631,24 @@ loadav(void *arg)
loadav, NULL);
}
static void
lboltcb(void *arg)
{
wakeup(&lbolt);
callout_reset(&lbolt_callout, hz, lboltcb, NULL);
}
/* ARGSUSED */
static void
sched_setup(dummy)
void *dummy;
{
callout_init(&loadav_callout, 0);
callout_init(&lbolt_callout, 1);
/* Kick off timeout driven events by calling first time. */
loadav(NULL);
lboltcb(NULL);
}
/*

View file

@ -203,10 +203,6 @@ roundrobin(void *arg)
static fixpt_t ccpu = 0.95122942450071400909 * FSCALE; /* exp(-1/20) */
SYSCTL_INT(_kern, OID_AUTO, ccpu, CTLFLAG_RD, &ccpu, 0, "");
/* kernel uses `FSCALE', userland (SHOULD) use kern.fscale */
static int fscale __unused = FSCALE;
SYSCTL_INT(_kern, OID_AUTO, fscale, CTLFLAG_RD, 0, FSCALE, "");
/*
* If `ccpu' is not equal to `exp(-1/20)' and you still want to use the
* faster/more-accurate formula, you'll have to estimate CCPU_SHIFT below
@ -328,7 +324,6 @@ schedcpu(void *arg)
mtx_unlock_spin(&sched_lock);
} /* end of process loop */
sx_sunlock(&allproc_lock);
wakeup(&lbolt);
callout_reset(&schedcpu_callout, hz, schedcpu, NULL);
}