Comment 4 for bug 2026121

Revision history for this message
Thadeu Lima de Souza Cascardo (cascardo) wrote :

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 d78c9300c51d6ceed9f6d078d4e9366f259de28c
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);
    setitimer(ITIMER_PROF, NULL, &val);

    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.