diff options
| author | Eric Dumazet <edumazet@google.com> | 2024-08-27 11:49:16 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-09-04 13:28:28 +0200 |
| commit | 55526afdbb5241e1271ca64ea0eed8bcd52770da (patch) | |
| tree | c7d711b6ec5acda3e7582f7763b3e16043b4d250 /include/net | |
| parent | f6f5e39a3fe7cbdba190f42b28b40bdff03c8cf0 (diff) | |
| download | linux-55526afdbb5241e1271ca64ea0eed8bcd52770da.tar.gz linux-55526afdbb5241e1271ca64ea0eed8bcd52770da.tar.bz2 linux-55526afdbb5241e1271ca64ea0eed8bcd52770da.zip | |
net: busy-poll: use ktime_get_ns() instead of local_clock()
[ Upstream commit 0870b0d8b393dde53106678a1e2cec9dfa52f9b7 ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include/net')
| -rw-r--r-- | include/net/busy_poll.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/net/busy_poll.h b/include/net/busy_poll.h index 4dabeb6c76d3..9f2ce4d05c26 100644 --- a/include/net/busy_poll.h +++ b/include/net/busy_poll.h @@ -64,7 +64,7 @@ static inline bool sk_can_busy_loop(struct sock *sk) static inline unsigned long busy_loop_current_time(void) { #ifdef CONFIG_NET_RX_BUSY_POLL - return (unsigned long)(local_clock() >> 10); + return (unsigned long)(ktime_get_ns() >> 10); #else return 0; #endif |
