From d480dc76d9f8a72671a6f9a7d987d2389c2e2ee4 Mon Sep 17 00:00:00 2001 From: Eric Dumazet Date: Mon, 29 Apr 2024 13:40:22 +0000 Subject: [PATCH] net: move sysctl_skb_defer_max to net_hotdata sysctl_skb_defer_max is used in TCP fast path, move it to net_hodata. Signed-off-by: Eric Dumazet Reviewed-by: David Ahern Link: https://lore.kernel.org/r/20240429134025.1233626-3-edumazet@google.com Signed-off-by: Jakub Kicinski --- include/net/hotdata.h | 1 + net/core/dev.c | 1 - net/core/dev.h | 1 - net/core/hotdata.c | 1 + net/core/skbuff.c | 2 +- net/core/sysctl_net_core.c | 2 +- 6 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/net/hotdata.h b/include/net/hotdata.h index a6cff6590426..290499f72e18 100644 --- a/include/net/hotdata.h +++ b/include/net/hotdata.h @@ -39,6 +39,7 @@ struct net_hotdata { int dev_tx_weight; int dev_rx_weight; int sysctl_max_skb_frags; + int sysctl_skb_defer_max; }; #define inet_ehash_secret net_hotdata.tcp_protocol.secret diff --git a/net/core/dev.c b/net/core/dev.c index c9e59eff8ec8..cd7ba50eac15 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -4450,7 +4450,6 @@ EXPORT_SYMBOL(__dev_direct_xmit); *************************************************************************/ static DEFINE_PER_CPU(struct task_struct *, backlog_napi); -unsigned int sysctl_skb_defer_max __read_mostly = 64; int weight_p __read_mostly = 64; /* old backlog weight */ int dev_weight_rx_bias __read_mostly = 1; /* bias for backlog weight */ int dev_weight_tx_bias __read_mostly = 1; /* bias for output_queue quota */ diff --git a/net/core/dev.h b/net/core/dev.h index 8572d2c8dc4a..b7b518bc2be5 100644 --- a/net/core/dev.h +++ b/net/core/dev.h @@ -36,7 +36,6 @@ int dev_addr_init(struct net_device *dev); void dev_addr_check(struct net_device *dev); /* sysctls not referred to from outside net/core/ */ -extern unsigned int sysctl_skb_defer_max; extern int netdev_unregister_timeout_secs; extern int weight_p; extern int dev_weight_rx_bias; diff --git a/net/core/hotdata.c b/net/core/hotdata.c index f17cbb4807b9..a359ff160d54 100644 --- a/net/core/hotdata.c +++ b/net/core/hotdata.c @@ -19,5 +19,6 @@ struct net_hotdata net_hotdata __cacheline_aligned = { .dev_tx_weight = 64, .dev_rx_weight = 64, .sysctl_max_skb_frags = MAX_SKB_FRAGS, + .sysctl_skb_defer_max = 64, }; EXPORT_SYMBOL(net_hotdata); diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 65779b8f0b12..5f382e94b4d1 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -6985,7 +6985,7 @@ nodefer: kfree_skb_napi_cache(skb); DEBUG_NET_WARN_ON_ONCE(skb->destructor); sd = &per_cpu(softnet_data, cpu); - defer_max = READ_ONCE(sysctl_skb_defer_max); + defer_max = READ_ONCE(net_hotdata.sysctl_skb_defer_max); if (READ_ONCE(sd->defer_count) >= defer_max) goto nodefer; diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c index e75375d54b9e..118c78615543 100644 --- a/net/core/sysctl_net_core.c +++ b/net/core/sysctl_net_core.c @@ -654,7 +654,7 @@ static struct ctl_table net_core_table[] = { }, { .procname = "skb_defer_max", - .data = &sysctl_skb_defer_max, + .data = &net_hotdata.sysctl_skb_defer_max, .maxlen = sizeof(unsigned int), .mode = 0644, .proc_handler = proc_dointvec_minmax,