mbox series

[v3,0/2] Upper bound kernel timers

Message ID 20220330082046.3512424-1-asavkov@redhat.com (mailing list archive)
Headers show
Series Upper bound kernel timers | expand

Message

Artem Savkov March 30, 2022, 8:20 a.m. UTC
As previously discussed [1] we had a report of a regression in TCP keepalive
timer where timers were up to 4 minutes late resulting in disconnects.

This patchset tries to fix the problem by introducing upper bound kernel timers
and making tcp keepalive timer use those.

[1] https://lore.kernel.org/all/20210302001054.4qgrvnkltvkgikzr@treble/T/#u

---
Changes in v3:
  - A different approach: instead of introducing upper bound timers try to
    account for timer wheen granularity on timer (re)arming step.
  - Not sure whether moving lvl calculation into a separate function is worth
    it.
  - Had a hard time naming the upper_bount_timeout() function - any suggestions
    welcome.

Changes in v2:
  - TIMER_UPPER_BOUND flag description added as a comment in timer.h
  - Code style fixes
  - More elaborate commit message in timer commit

Artem Savkov (2):
  timer: add a function to adjust timeouts to be upper bound
  net: make tcp keepalive timer upper bound

 include/linux/timer.h           |  1 +
 kernel/time/timer.c             | 92 ++++++++++++++++++++++++++++-----
 net/ipv4/inet_connection_sock.c |  2 +-
 3 files changed, 81 insertions(+), 14 deletions(-)

Comments

David Laight March 30, 2022, 10:28 a.m. UTC | #1
From: Artem Savkov
> Sent: 30 March 2022 09:21
> 
> As previously discussed [1] we had a report of a regression in TCP keepalive
> timer where timers were up to 4 minutes late resulting in disconnects.
> 
> This patchset tries to fix the problem by introducing upper bound kernel timers
> and making tcp keepalive timer use those.

Why not just fix the timer code to work properly (as it used to) so that the
timers expire within a short time of the requested interval.

This just requires that expiring 'long' timers get moved into the
higher precision 'wheels' (or whatever) before they actually expire.

The burden for this is minimal - it only affects long duration timers
that actually expire, and each timer only gets moved once for each
level of timer precision.

Perhaps you only need to move them two or three times in order to
get a reasonable accuracy.
No one is going to mind if a 5 minute timer is a second late.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)