* [PATCH] net: set the minimum for net_hotdata.netdev_budget_usecs
@ 2025-02-20 11:07 Jiri Slaby (SUSE)
2025-02-22 0:40 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Jiri Slaby (SUSE) @ 2025-02-20 11:07 UTC (permalink / raw)
To: kuba
Cc: davem, edumazet, pabeni, horms, netdev, linux-kernel,
Jiri Slaby (SUSE),
Dmitry Yakunin, Konstantin Khlebnikov
Commit 7acf8a1e8a28 ("Replace 2 jiffies with sysctl netdev_budget_usecs
to enable softirq tuning") added a possibility to set
net_hotdata.netdev_budget_usecs, but added no lower bound checking.
Commit a4837980fd9f ("net: revert default NAPI poll timeout to 2 jiffies")
made the *initial* value HZ-dependent, so the initial value is at least
2 jiffies even for lower HZ values (2 ms for 1000 Hz, 8ms for 250 Hz, 20
ms for 100 Hz).
But a user still can set improper values by a sysctl. Set .extra1
(the lower bound) for net_hotdata.netdev_budget_usecs to the same value
as in the latter commit. That is to 2 jiffies.
Fixes: a4837980fd9f ("net: revert default NAPI poll timeout to 2 jiffies")
Fixes: 7acf8a1e8a28 ("Replace 2 jiffies with sysctl netdev_budget_usecs to enable softirq tuning")
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
Cc: Dmitry Yakunin <zeil@yandex-team.ru>
Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Cc: David S. Miller <davem@davemloft.net>
---
net/core/sysctl_net_core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index ad2741f1346a..c7769ee0d9c5 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -34,6 +34,7 @@ static int min_sndbuf = SOCK_MIN_SNDBUF;
static int min_rcvbuf = SOCK_MIN_RCVBUF;
static int max_skb_frags = MAX_SKB_FRAGS;
static int min_mem_pcpu_rsv = SK_MEMORY_PCPU_RESERVE;
+static int netdev_budget_usecs_min = 2 * USEC_PER_SEC / HZ;
static int net_msg_warn; /* Unused, but still a sysctl */
@@ -587,7 +588,7 @@ static struct ctl_table net_core_table[] = {
.maxlen = sizeof(unsigned int),
.mode = 0644,
.proc_handler = proc_dointvec_minmax,
- .extra1 = SYSCTL_ZERO,
+ .extra1 = &netdev_budget_usecs_min,
},
{
.procname = "fb_tunnels_only_for_init_net",
--
2.48.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] net: set the minimum for net_hotdata.netdev_budget_usecs
2025-02-20 11:07 [PATCH] net: set the minimum for net_hotdata.netdev_budget_usecs Jiri Slaby (SUSE)
@ 2025-02-22 0:40 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-02-22 0:40 UTC (permalink / raw)
To: Jiri Slaby
Cc: kuba, davem, edumazet, pabeni, horms, netdev, linux-kernel, zeil,
khlebnikov
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 20 Feb 2025 12:07:52 +0100 you wrote:
> Commit 7acf8a1e8a28 ("Replace 2 jiffies with sysctl netdev_budget_usecs
> to enable softirq tuning") added a possibility to set
> net_hotdata.netdev_budget_usecs, but added no lower bound checking.
>
> Commit a4837980fd9f ("net: revert default NAPI poll timeout to 2 jiffies")
> made the *initial* value HZ-dependent, so the initial value is at least
> 2 jiffies even for lower HZ values (2 ms for 1000 Hz, 8ms for 250 Hz, 20
> ms for 100 Hz).
>
> [...]
Here is the summary with links:
- net: set the minimum for net_hotdata.netdev_budget_usecs
https://git.kernel.org/netdev/net/c/c180188ec022
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-02-22 0:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-20 11:07 [PATCH] net: set the minimum for net_hotdata.netdev_budget_usecs Jiri Slaby (SUSE)
2025-02-22 0:40 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®