net: busy-poll: use ktime_get_ns() instead of local_clock()
authorEric Dumazet <edumazet@google.com>
Tue, 27 Aug 2024 11:49:16 +0000 (11:49 +0000)
committerJakub Kicinski <kuba@kernel.org>
Thu, 29 Aug 2024 00:53:13 +0000 (17:53 -0700)
commit0870b0d8b393dde53106678a1e2cec9dfa52f9b7
tree0742294b9f38e24f2ad958ef29132589d48d9250
parent41901c227e00ca6cd1a42d1d59a51f3a5af1621b
net: busy-poll: use ktime_get_ns() instead of local_clock()

Typically, busy-polling durations are below 100 usec.

When/if the busy-poller thread migrates to another cpu,
local_clock() can be off by +/-2msec or more for small
values of HZ, depending on the platform.

Use ktimer_get_ns() to ensure deterministic behavior,
which is the whole point of busy-polling.

Fixes: 060212928670 ("net: add low latency socket poll")
Fixes: 9a3c71aa8024 ("net: convert low latency sockets to sched_clock()")
Fixes: 37089834528b ("sched, net: Fixup busy_loop_us_clock()")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Mina Almasry <almasrymina@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Reviewed-by: Joe Damato <jdamato@fastly.com>
Link: https://patch.msgid.link/20240827114916.223377-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/net/busy_poll.h