Subject: Re: ppsratecheck(9)
To: Atsushi Onoe <onoe@sm.sony.co.jp>
From: None <itojun@iijlab.net>
List: tech-kern
Date: 07/07/2000 15:44:00
>> >splclock() should only protect reference to mono_time, not whole the
>> >function.
>> >mono_time should be cached at the beginning of the function.
>> i took this part from ratecheck(9).
>Hmm, it would be better also fix ratecheck(9). Trying to minimize the
>protected region is always a good idea if there are no overhead, IMHO.
i think i agree with it. i'll update ratecheck(9) too when i commit
ppsratecheck.
>> >*curpps and maxpps should be unsigned.
>> maybe, maybe not. anyone care about more than 2^31 events?
>> if really so, long or u_long.
>If you think it never occur, you might make wrap-around check to be
>commented out.
>> >Since *curpps should be unsigned, this would be
>> > if (*curpps + 1 != 0)
>> if (*curpps + 1 > *curpps) should do for both signed and unsigned.
>Again, ommiting this check would be harmless in practice. Just comparing
>to zero looks slightly lighter for me (at least on some platforms), though
>won't affect the total performance at all.
i object.
from my experience, it is bad practice to omit this kind of checks.
it will bite us in the future. for example, substantial portion of
KAME work was to remove assumptions on mbuf size boundary (which
became false due to like increased struct size), or adding proper
checks/MCLGET calls.
itojun