2019-05-29 16:57:49 -07:00
|
|
|
|
2013-06-10 11:39:50 +03:00
|
|
|
|
2013-07-10 17:13:26 +03:00
|
|
|
|
2013-06-10 11:39:50 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-07-10 17:13:26 +03:00
|
|
|
|
|
|
|
|
|
2013-06-10 11:39:50 +03:00
|
|
|
|
|
|
|
|
|
2017-02-01 16:36:40 +01:00
|
|
|
|
2017-02-02 19:15:33 +01:00
|
|
|
|
2013-06-10 11:39:50 +03:00
|
|
|
|
2023-08-02 18:02:30 -07:00
|
|
|
|
2013-06-10 11:39:50 +03:00
|
|
|
|
2017-03-24 10:07:53 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-11-30 19:51:57 +01:00
|
|
|
|
|
|
|
|
|
2017-08-11 18:31:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-07-08 16:20:34 +03:00
|
|
|
|
2013-06-28 15:59:35 +03:00
|
|
|
|
2022-08-23 10:46:51 -07:00
|
|
|
|
2013-06-28 15:59:35 +03:00
|
|
|
|
|
|
|
|
|
2016-11-15 10:15:12 -08:00
|
|
|
|
2013-06-10 11:39:50 +03:00
|
|
|
|
2021-06-29 07:12:45 -07:00
|
|
|
|
2013-06-10 11:39:50 +03:00
|
|
|
|
|
|
|
|
|
2017-03-24 10:08:24 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-11-30 19:51:57 +01:00
|
|
|
|
2013-06-10 11:39:50 +03:00
|
|
|
|
2024-02-06 09:30:04 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-11-09 05:02:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-08-01 11:10:25 +08:00
|
|
|
|
2013-07-08 16:20:34 +03:00
|
|
|
|
2013-06-28 15:59:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-10 11:39:50 +03:00
|
|
|
|
2013-07-08 16:20:34 +03:00
|
|
|
|
2013-06-10 11:39:50 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-08-01 11:10:25 +08:00
|
|
|
|
2016-11-16 09:10:42 -08:00
|
|
|
|
2017-03-24 10:08:18 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-08-27 11:49:16 +00:00
|
|
|
|
2017-03-24 10:08:18 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-03-24 10:08:24 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
net: Introduce preferred busy-polling
The existing busy-polling mode, enabled by the SO_BUSY_POLL socket
option or system-wide using the /proc/sys/net/core/busy_read knob, is
an opportunistic. That means that if the NAPI context is not
scheduled, it will poll it. If, after busy-polling, the budget is
exceeded the busy-polling logic will schedule the NAPI onto the
regular softirq handling.
One implication of the behavior above is that a busy/heavy loaded NAPI
context will never enter/allow for busy-polling. Some applications
prefer that most NAPI processing would be done by busy-polling.
This series adds a new socket option, SO_PREFER_BUSY_POLL, that works
in concert with the napi_defer_hard_irqs and gro_flush_timeout
knobs. The napi_defer_hard_irqs and gro_flush_timeout knobs were
introduced in commit 6f8b12d661d0 ("net: napi: add hard irqs deferral
feature"), and allows for a user to defer interrupts to be enabled and
instead schedule the NAPI context from a watchdog timer. When a user
enables the SO_PREFER_BUSY_POLL, again with the other knobs enabled,
and the NAPI context is being processed by a softirq, the softirq NAPI
processing will exit early to allow the busy-polling to be performed.
If the application stops performing busy-polling via a system call,
the watchdog timer defined by gro_flush_timeout will timeout, and
regular softirq handling will resume.
In summary; Heavy traffic applications that prefer busy-polling over
softirq processing should use this option.
Example usage:
$ echo 2 | sudo tee /sys/class/net/ens785f1/napi_defer_hard_irqs
$ echo 200000 | sudo tee /sys/class/net/ens785f1/gro_flush_timeout
Note that the timeout should be larger than the userspace processing
window, otherwise the watchdog will timeout and fall back to regular
softirq processing.
Enable the SO_BUSY_POLL/SO_PREFER_BUSY_POLL options on your socket.
Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Link: https://lore.kernel.org/bpf/20201130185205.196029-2-bjorn.topel@gmail.com
2020-11-30 19:51:56 +01:00
|
|
|
|
2020-11-30 19:51:57 +01:00
|
|
|
|
|
|
|
|
|
2017-03-24 10:08:24 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-03-24 10:08:06 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-06-18 14:22:15 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-03-24 10:08:06 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-08-22 13:57:33 +01:00
|
|
|
|
2016-11-16 09:10:42 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-10-25 09:48:18 -07:00
|
|
|
|
|
|
|
|
|
2016-11-16 09:10:42 -08:00
|
|
|
|
2021-11-30 10:29:39 -08:00
|
|
|
|
2016-11-16 09:10:42 -08:00
|
|
|
|
|
|
|
|
|
2021-12-02 15:37:24 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-12-01 15:22:59 +01:00
|
|
|
|
2020-11-30 19:52:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-11-16 09:10:42 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-12-01 15:22:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-11-30 19:52:01 +01:00
|
|
|
|
|
|
|
|
|
2013-07-10 17:13:26 +03:00
|
|
|
|