aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/scripts
diff options
context:
space:
mode:
authorAnna-Maria Behnsen <anna-maria@linutronix.de>2024-10-14 10:22:24 +0200
committerThomas Gleixner <tglx@linutronix.de>2024-10-16 00:36:47 +0200
commit82e11e47c1880362e05c065bef7dbe28a749555c (patch)
tree3f38d2840284601f57e49c275163288ee1db530b /scripts
parentdelay: Rework udelay and ndelay (diff)
downloadwireguard-linux-82e11e47c1880362e05c065bef7dbe28a749555c.tar.xz
wireguard-linux-82e11e47c1880362e05c065bef7dbe28a749555c.zip
timers: Adjust flseep() to reflect reality
fsleep() simply implements the recommendations of the outdated documentation in "Documentation/timers/timers-howto.rst". This should be a user friendly interface to choose always the best timeout function approach: - udelay() for very short sleep durations shorter than 10 microseconds - usleep_range() for sleep durations until 20 milliseconds - msleep() for the others The actual implementation has several problems: - It does not take into account that HZ resolution also has an impact on granularity of jiffies and has also an impact on the granularity of the buckets of timer wheel levels. This means that accuracy for the timeout does not have an upper limit. When executing fsleep(20000) on a HZ=100 system, the possible additional slack will be 50% as the granularity of the buckets in the lowest level is 10 milliseconds. - The upper limit of usleep_range() is twice the requested timeout. When no other interrupts occur in this range, the maximum value is used. This means that the requested sleep length has then an additional delay of 100%. Change the thresholds for the decisions in fsleep() to make sure the maximum slack which is added to the sleep duration is 25%. Note: Outdated documentation will be updated in a followup patch. Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Frederic Weisbecker <frederic@kernel.org> Link: https://lore.kernel.org/all/20241014-devel-anna-maria-b4-timers-flseep-v3-7-dc8b907cb62f@linutronix.de
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions