On Tue, May 25, 2021 at 10:21:40PM +0200, Christoph Badura wrote:
> On Wed, May 26, 2021 at 05:02:52AM +1000, matthew green wrote:
> > > > +options        HZ=8000
> > this can become a problem due to integer division.
> > 
> > any number of ticks less than hz (8000) will be rounded
> > down to 0 in a number of places now, where as before it
> > was only less than 100.  i've seen this trip up in the
> > kernel before, and sometimes that '0' means 'poll', and
> > sometimes it means 'sleep forever'.
> 
> > a lot of places in the kernel *do* avoid (eg, with adding
> > hz-1 and then dividing by hz) but there are a number that
> > do not...
> 
> So, should we introduce a CPP macro or an inline function that abstracts
> the common code away in a way that avoids such rounding down and
> produces correct results?

We already have mstohz() and hztoms()

-- 
Manuel Bouyer <bou...@antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--

Reply via email to