On xenial, CONFIG_HZ=250. It does work in multiples of 4000.
The commit below does purport to fix a problem. Perhaps, we should adjust the test to work with these older kernels that still rely on jiffies for the VIRTUAL and PROF itimers intervals, and just make sure that rounding works correctly and the error pointed out by the commit below does not happen.
I don't see what value could be used that would work out for any of HZ=1000, HZ=300, HZ=250 and HZ=100, but perhaps we can ignore HZ=300 and just go with 20'000 usecs (which may just work out with HZ=300).
timeval_to_jiffies tried to round a timeval up to an integral number
of jiffies, but the logic for doing so was incorrect: intervals
corresponding to exactly N jiffies would become N+1. This manifested
itself particularly repeatedly stopping/starting an itimer:
would add a full tick to val, _even if it was exactly representable in
terms of jiffies_ (say, the result of a previous rounding.) Doing
this repeatedly would cause unbounded growth in val. So fix the math.
On xenial, CONFIG_HZ=250. It does work in multiples of 4000.
The commit below does purport to fix a problem. Perhaps, we should adjust the test to work with these older kernels that still rely on jiffies for the VIRTUAL and PROF itimers intervals, and just make sure that rounding works correctly and the error pointed out by the commit below does not happen.
I don't see what value could be used that would work out for any of HZ=1000, HZ=300, HZ=250 and HZ=100, but perhaps we can ignore HZ=300 and just go with 20'000 usecs (which may just work out with HZ=300).
commit d78c9300c51d6ce ed9f6d078d4e936 6f259de28c
Author: Andrew Hunter <email address hidden>
Date: Thu Sep 4 14:17:16 2014 -0700
jiffies: Fix timeval conversion to jiffies
timeval_ to_jiffies tried to round a timeval up to an integral number
of jiffies, but the logic for doing so was incorrect: intervals
corresponding to exactly N jiffies would become N+1. This manifested
itself particularly repeatedly stopping/starting an itimer:
setitimer( ITIMER_ PROF, &val, NULL); ITIMER_ PROF, NULL, &val);
setitimer(
would add a full tick to val, _even if it was exactly representable in
terms of jiffies_ (say, the result of a previous rounding.) Doing
this repeatedly would cause unbounded growth in val. So fix the math.