Skip to content

Commit c180188

Browse files
Jiri Slaby (SUSE)kuba-moo
authored andcommitted
net: set the minimum for net_hotdata.netdev_budget_usecs
Commit 7acf8a1 ("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 a483798 ("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: a483798 ("net: revert default NAPI poll timeout to 2 jiffies") Fixes: 7acf8a1 ("Replace 2 jiffies with sysctl netdev_budget_usecs to enable softirq tuning") Signed-off-by: Jiri Slaby (SUSE) <[email protected]> Cc: Dmitry Yakunin <[email protected]> Cc: Konstantin Khlebnikov <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 0e4427f commit c180188

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/core/sysctl_net_core.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ static int min_sndbuf = SOCK_MIN_SNDBUF;
3434
static int min_rcvbuf = SOCK_MIN_RCVBUF;
3535
static int max_skb_frags = MAX_SKB_FRAGS;
3636
static int min_mem_pcpu_rsv = SK_MEMORY_PCPU_RESERVE;
37+
static int netdev_budget_usecs_min = 2 * USEC_PER_SEC / HZ;
3738

3839
static int net_msg_warn; /* Unused, but still a sysctl */
3940

@@ -587,7 +588,7 @@ static struct ctl_table net_core_table[] = {
587588
.maxlen = sizeof(unsigned int),
588589
.mode = 0644,
589590
.proc_handler = proc_dointvec_minmax,
590-
.extra1 = SYSCTL_ZERO,
591+
.extra1 = &netdev_budget_usecs_min,
591592
},
592593
{
593594
.procname = "fb_tunnels_only_for_init_net",

0 commit comments

Comments
 (0)