> Date: Mon, 14 Aug 2017 16:06:51 -0400 > From: Martin Pieuchot <m...@openbsd.org> > > I'd like to improve the fairness of the scheduler, with the goal of > mitigating userland starvations. For that the kernel needs to have > a better understanding of the amount of executed time per task. > > The smallest interval currently usable on all our architectures for > such accounting is a tick. With the current HZ value of 100, this > smallest interval is 10ms. I'd like to bump this value to 1000. > > The diff below intentionally bump other `hz' value to keep current > ratios. We certainly want to call schedclock(), or a similar time > accounting function, at a higher frequency than 16 Hz. However this > will be part of a later diff. > > I'd be really interested in test reports. mlarkin@ raised a good > question: is your battery lifetime shorter with this diff? > > Comments, oks?
Need to look at this a bit more carefully but: > Index: conf/param.c > =================================================================== > RCS file: /cvs/src/sys/conf/param.c,v > retrieving revision 1.37 > diff -u -p -r1.37 param.c > --- conf/param.c 6 May 2016 19:45:35 -0000 1.37 > +++ conf/param.c 14 Aug 2017 17:03:23 -0000 > @@ -76,7 +76,7 @@ > # define DST 0 > #endif > #ifndef HZ > -#define HZ 100 > +#define HZ 1000 > #endif > int hz = HZ; > int tick = 1000000 / HZ; > Index: kern/kern_clock.c > =================================================================== > RCS file: /cvs/src/sys/kern/kern_clock.c,v > retrieving revision 1.93 > diff -u -p -r1.93 kern_clock.c > --- kern/kern_clock.c 22 Jul 2017 14:33:45 -0000 1.93 > +++ kern/kern_clock.c 14 Aug 2017 19:50:49 -0000 > @@ -406,12 +406,11 @@ statclock(struct clockframe *frame) > if (p != NULL) { > p->p_cpticks++; > /* > - * If no schedclock is provided, call it here at ~~12-25 Hz; > + * If no schedclock is provided, call it here; > * ~~16 Hz is best > */ > if (schedhz == 0) { > - if ((++curcpu()->ci_schedstate.spc_schedticks & 3) == > - 0) > + if ((spc->spc_schedticks & 0x3f) == 0) That ++ should not be dropped sould it?