net: skbuff: clean up unnecessary includes
Subsystems (16)
Jakub Kicinski
maintainercover net: skbuff: clean up unnecessary includes
skbuff.h is included in a significant portion of the tree. Clean up unused dependencies to speed up builds.
This set only takes care of the most obvious cases.
Jakub Kicinski (11):
net: add missing includes of linux/net.h
net: skbuff: drop the linux/net.h include
net: checksum: drop the linux/uaccess.h include
net: skbuff: drop the linux/textsearch.h include
net: add missing includes of linux/sched/clock.h
net: skbuff: drop the linux/sched/clock.h include
net: skbuff: drop the linux/sched.h include
net: add missing includes of linux/splice.h
net: skbuff: drop the linux/splice.h include
net: skbuff: drop the linux/hrtimer.h include
net: remove unnecessary includes from net/flow.h
arch/arm/include/asm/checksum.h | 1 + arch/x86/include/asm/checksum_64.h | 1 - drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c | 1 + drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c | 2 ++ drivers/net/wireless/intersil/orinoco/hermes.c | 1 + drivers/scsi/lpfc/lpfc_init.c | 1 + include/linux/filter.h | 1 + include/linux/igmp.h | 1 + include/linux/skbuff.h | 7 +------ include/net/checksum.h | 4 +++- include/net/flow.h | 5 +++-- net/core/skbuff.c | 1 + net/rds/ib_recv.c | 1 + net/rds/recv.c | 1 + net/smc/af_smc.c | 1 + net/smc/smc_rx.c | 1 + net/unix/af_unix.c | 1 + 17 files changed, 21 insertions(+), 10 deletions(-)
Signature · 1 line
2.39.1
Jakub Kicinski
maintainerPATCH 1/11 net: add missing includes of linux/net.h
linux/net.h will soon not be included by linux/skbuff.h. Fix the cases where source files were depending on the implicit include.
---
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
--- drivers/net/wireless/intersil/orinoco/hermes.c | 1 + include/linux/igmp.h | 1 + 2 files changed, 2 insertions(+)
drivers/net/wireless/intersil/orinoco/hermes.c +1 -0
@@ -38,6 +38,7 @@* under either the MPL or the GPL. */ +#include <linux/net.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/delay.h>
include/linux/igmp.h +1 -0
@@ -15,6 +15,7 @@#include <linux/in.h> #include <linux/ip.h> #include <linux/refcount.h> +#include <linux/sockptr.h> #include <uapi/linux/igmp.h> static inline struct igmphdr *igmp_hdr (const struct sk_buff *skb)
Signature · 1 line
2.39.1
Jakub Kicinski
maintainerPATCH 2/11 net: skbuff: drop the linux/net.h include
In reply to Jakub KicinskiIt appears nothing needs it. The kernel builds fine with this include removed, building an otherwise empty source file with:
#include <linux/skbuff.h>
#ifdef _LINUX_NET_H
#error linux/net.h is back
#endif
works too (meaning net.h is not just pulled in indirectly).
This gives us a slight 0.5% reduction in the pre-processed size of skbuff.h.
---
CC: [email protected]
--- include/linux/skbuff.h | 1 - 1 file changed, 1 deletion(-)
include/linux/skbuff.h +0 -1
@@ -23,7 +23,6 @@#include <linux/atomic.h> #include <asm/types.h> #include <linux/spinlock.h> -#include <linux/net.h> #include <linux/textsearch.h> #include <net/checksum.h> #include <linux/rcupdate.h>
Signature · 1 line
2.39.1
Jakub Kicinski
maintainerPATCH 3/11 net: checksum: drop the linux/uaccess.h include
In reply to Jakub Kicinskinet/checksum.h pulls in linux/uaccess.h which is large.
In the x86 header the include seems to not be needed at all. ARM on the other hand does not include uaccess.h, even tho it calls access_ok().
In the generic implementation guard the include of linux/uaccess.h with the same condition as the code that needs it.
With this change pre-processed net/checksum.h shrinks on x86 from 30616 lines to just 1193.
---
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
--- arch/arm/include/asm/checksum.h | 1 + arch/x86/include/asm/checksum_64.h | 1 - include/net/checksum.h | 4 +++- 3 files changed, 4 insertions(+), 2 deletions(-)
arch/arm/include/asm/checksum.h +1 -0
@@ -11,6 +11,7 @@#define __ASM_ARM_CHECKSUM_H#include <linux/in6.h> +#include <linux/uaccess.h> /* * computes the checksum of a memory block at buff, length len,
arch/x86/include/asm/checksum_64.h +0 -1
@@ -9,7 +9,6 @@*/ #include <linux/compiler.h> -#include <linux/uaccess.h> #include <asm/byteorder.h> /**
include/net/checksum.h +3 -1
@@ -18,8 +18,10 @@#include <linux/errno.h> #include <asm/types.h> #include <asm/byteorder.h> -#include <linux/uaccess.h> #include <asm/checksum.h> +#if !defined(_HAVE_ARCH_COPY_AND_CSUM_FROM_USER) || !defined(HAVE_CSUM_COPY_USER ) +#include <linux/uaccess.h> +#endif #ifndef _HAVE_ARCH_COPY_AND_CSUM_FROM_USER static __always_inline
Signature · 1 line
2.39.1
Jakub Kicinski
maintainerPATCH 4/11 net: skbuff: drop the linux/textsearch.h include
In reply to Jakub KicinskiThis include was added for skb_find_text() but all we need there is a forward declaration of struct ts_config.
---
CC: [email protected]
--- include/linux/skbuff.h | 2 +- net/core/skbuff.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
include/linux/skbuff.h +1 -1
@@ -23,7 +23,6 @@#include <linux/atomic.h> #include <asm/types.h> #include <linux/spinlock.h> -#include <linux/textsearch.h> #include <net/checksum.h> #include <linux/rcupdate.h> #include <linux/hrtimer.h>
@@ -279,6 +278,7 @@ struct napi_struct;struct bpf_prog ;union bpf_attr ;struct skb_ext ; +struct ts_config ;#if IS_ENABLED (CONFIG_BRIDGE_NETFILTER ) struct nf_bridge_info {
net/core/skbuff.c +1 -0
@@ -79,6 +79,7 @@#include <linux/capability.h> #include <linux/user_namespace.h> #include <linux/indirect_call_wrapper.h> +#include <linux/textsearch.h> #include "dev.h" #include "sock_destructor.h"
Signature · 1 line
2.39.1
Jakub Kicinski
maintainerPATCH 5/11 net: add missing includes of linux/sched/clock.h
In reply to Jakub KicinskiNumber of files depend on linux/sched/clock.h getting included by linux/skbuff.h which soon will no longer be the case.
---
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c | 1 + drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c | 2 ++ drivers/scsi/lpfc/lpfc_init.c | 1 + include/linux/filter.h | 1 + net/rds/ib_recv.c | 1 + net/rds/recv.c | 1 + 6 files changed, 7 insertions(+)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c +1 -0
@@ -2,6 +2,7 @@/* Copyright (c) 2018-2019 Hisilicon Limited. */ #include <linux/device.h> +#include <linux/sched/clock.h> #include "hclge_debugfs.h" #include "hclge_err.h"
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c +2 -0
@@ -1,6 +1,8 @@// SPDX-License-Identifier: GPL-2.0+ /* Copyright (c) 2016-2017 Hisilicon Limited. */ +#include <linux/sched/clock.h> +#include "hclge_err.h" static const struct hclge_hw_error hclge_imp_tcm_ecc_int[] = {
drivers/scsi/lpfc/lpfc_init.c +1 -0
@@ -30,6 +30,7 @@#include <linux/kthread.h> #include <linux/pci.h> #include <linux/spinlock.h> +#include <linux/sched/clock.h> #include <linux/ctype.h> #include <linux/aer.h> #include <linux/slab.h>
include/linux/filter.h +1 -0
@@ -14,6 +14,7 @@#include <linux/printk.h> #include <linux/workqueue.h> #include <linux/sched.h> +#include <linux/sched/clock.h> #include <linux/capability.h> #include <linux/set_memory.h> #include <linux/kallsyms.h>
net/rds/ib_recv.c +1 -0
@@ -31,6 +31,7 @@* */ #include <linux/kernel.h> +#include <linux/sched/clock.h> #include <linux/slab.h> #include <linux/pci.h> #include <linux/dma-mapping.h>
net/rds/recv.c +1 -0
@@ -35,6 +35,7 @@#include <net/sock.h> #include <linux/in.h> #include <linux/export.h> +#include <linux/sched/clock.h> #include <linux/time.h> #include <linux/rds.h>
Signature · 1 line
2.39.1
Jakub Kicinski
maintainerPATCH 6/11 net: skbuff: drop the linux/sched/clock.h include
In reply to Jakub KicinskiIt used to be necessary for skb_mstamp_* static inlines, but those are gone since we moved to usec timestamps in TCP, in 2017.
---
CC: [email protected]
--- include/linux/skbuff.h | 1 - 1 file changed, 1 deletion(-)
include/linux/skbuff.h +0 -1
@@ -29,7 +29,6 @@#include <linux/dma-mapping.h> #include <linux/netdev_features.h> #include <linux/sched.h> -#include <linux/sched/clock.h> #include <net/flow_dissector.h> #include <linux/splice.h> #include <linux/in6.h>
Signature · 1 line
2.39.1
Jakub Kicinski
maintainerPATCH 7/11 net: skbuff: drop the linux/sched.h include
In reply to Jakub Kicinskilinux/sched.h was added for skb_mstamp_* (all the way back before linux/sched.h got split and linux/sched/clock.h created). We don't need it in skbuff.h any more.
Sadly this change is currently a noop because linux/dma-mapping.h and net/page_pool.h pull in half of the universe.
---
CC: [email protected]
--- include/linux/skbuff.h | 1 - 1 file changed, 1 deletion(-)
include/linux/skbuff.h +0 -1
@@ -28,7 +28,6 @@#include <linux/hrtimer.h> #include <linux/dma-mapping.h> #include <linux/netdev_features.h> -#include <linux/sched.h> #include <net/flow_dissector.h> #include <linux/splice.h> #include <linux/in6.h>
Signature · 1 line
2.39.1
Jakub Kicinski
maintainerPATCH 8/11 net: add missing includes of linux/splice.h
In reply to Jakub KicinskiNumber of files depend on linux/splice.h getting included by linux/skbuff.h which soon will no longer be the case.
---
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
--- net/smc/af_smc.c | 1 + net/smc/smc_rx.c | 1 + net/unix/af_unix.c | 1 + 3 files changed, 3 insertions(+)
net/smc/af_smc.c +1 -0
@@ -27,6 +27,7 @@#include <linux/if_vlan.h> #include <linux/rcupdate_wait.h> #include <linux/ctype.h> +#include <linux/splice.h> #include <net/sock.h> #include <net/tcp.h>
net/smc/smc_rx.c +1 -0
@@ -13,6 +13,7 @@#include <linux/net.h> #include <linux/rcupdate.h> #include <linux/sched/signal.h> +#include <linux/splice.h> #include <net/sock.h> #include <trace/events/sock.h>
net/unix/af_unix.c +1 -0
@@ -112,6 +112,7 @@#include <linux/mount.h> #include <net/checksum.h> #include <linux/security.h> +#include <linux/splice.h> #include <linux/freezer.h> #include <linux/file.h> #include <linux/btf_ids.h>
Signature · 1 line
2.39.1
Re: [PATCH net-next 08/11] net: add missing includes of linux/splice.h
Quoted 33 lines · Jakub Kicinski
Number of files depend on
linux/splice.hgetting included bylinux/skbuff.hwhich soon will no longer be the case.Signed-off-by Jakub Kicinski <[email protected]>---
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]--- net/smc/af_smc.c | 1 + net/smc/smc_rx.c | 1 + net/unix/af_unix.c | 1 + 3 files changed, 3 insertions(+)net/smc/af_smc.c +1
-0@@ -27,6 +27,7 @@#include <linux/if_vlan.h> #include <linux/rcupdate_wait.h> #include <linux/ctype.h> +#include <linux/splice.h> #include <net/sock.h> #include <net/tcp.h> net/smc/smc_rx.c +0
-0
net/smc/smc_rx.c line 17
Quoted 5 lines
net/smc/smc_rx.c +1
-0@@ -13,6 +13,7 @@#include <linux/net.h> #include <linux/rcupdate.h> #include <linux/sched/signal.h> +#include <linux/splice.h>
Thank you, Jakub!
Quoted 14 lines
net/smc/smc_rx.c +0
-0#include <net/sock.h> #include <trace/events/sock.h> net/unix/af_unix.c +1
-0@@ -112,6 +112,7 @@#include <linux/mount.h> #include <net/checksum.h> #include <linux/security.h> +#include <linux/splice.h> #include <linux/freezer.h> #include <linux/file.h> #include <linux/btf_ids.h>
Jakub Kicinski
maintainerPATCH 9/11 net: skbuff: drop the linux/splice.h include
In reply to Jakub Kicinskisplice.h is included since commit a60e3cc7c929 ("net: make skb_splice_bits more configureable") but really even then all we needed is some forward declarations. Most of that code is now gone, and remaining has fwd declarations.
---
CC: [email protected]
--- include/linux/skbuff.h | 1 - 1 file changed, 1 deletion(-)
include/linux/skbuff.h +0 -1
@@ -29,7 +29,6 @@#include <linux/dma-mapping.h> #include <linux/netdev_features.h> #include <net/flow_dissector.h> -#include <linux/splice.h> #include <linux/in6.h> #include <linux/if_packet.h> #include <linux/llist.h>
Signature · 1 line
2.39.1
Jakub Kicinski
maintainerPATCH 10/11 net: skbuff: drop the linux/hrtimer.h include
In reply to Jakub Kicinskilinux/hrtimer.h include was added because apparently it used to contain ktime related code. This is no longer the case and we include linux/time.h explicitly.
Sadly this change is currently a noop because linux/dma-mapping.h and net/page_pool.h pull in half of the universe.
---
CC: [email protected]
--- include/linux/skbuff.h | 1 - 1 file changed, 1 deletion(-)
include/linux/skbuff.h +0 -1
@@ -25,7 +25,6 @@#include <linux/spinlock.h> #include <net/checksum.h> #include <linux/rcupdate.h> -#include <linux/hrtimer.h> #include <linux/dma-mapping.h> #include <linux/netdev_features.h> #include <net/flow_dissector.h>
Signature · 1 line
2.39.1
Jakub Kicinski
maintainerPATCH 11/11 net: remove unnecessary includes from net/flow.h
In reply to Jakub KicinskiThis file is included by a lot of other commonly included headers, it doesn't need socket.h or flow_dissector.h.
This reduces the size of this file after pre-processing from 28165 to 4663.
---
--- include/net/flow.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
include/net/flow.h +3 -2
@@ -8,12 +8,13 @@#ifndef _NET_FLOW_H#define _NET_FLOW_H -#include <linux/socket.h> #include <linux/in6.h> #include <linux/atomic.h> -#include <net/flow_dissector.h> +#include <linux/container_of.h> #include <linux/uidgid.h> +struct flow_keys ; +/* * ifindex generation is per-net namespace, and loopback is * always the 1st device in ns (see net_dev_init), thus any
Signature · 1 line
2.39.1
This series was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:
Quoted 18 lines · On Wed, 25 Jan 2023 23:14:13 -0800 you wrote:
skbuff.his included in a significant portion of the tree. Clean up unused dependencies to speed up builds.This set only takes care of the most obvious cases.
Jakub Kicinski (11):
net: add missing includes oflinux/net.h
net: skbuff: drop thelinux/net.hinclude
net: checksum: drop thelinux/uaccess.hinclude
net: skbuff: drop thelinux/textsearch.hinclude
net: add missing includes oflinux/sched/clock.h
net: skbuff: drop thelinux/sched/clock.hinclude
net: skbuff: drop thelinux/sched.hinclude
net: add missing includes oflinux/splice.h
net: skbuff: drop thelinux/splice.hinclude
net: skbuff: drop thelinux/hrtimer.hinclude
net: remove unnecessary includes fromnet/flow.h
Quoted 1 line
[...]
Here is the summary with links:
- [net-next,01/11] net: add missing includes of linux/net.h
https://git.kernel.org/netdev/net-next/c/ac62f60619fa - [net-next,02/11] net: skbuff: drop the linux/net.h include https://git.kernel.org/netdev/net-next/c/9a859da28787 - [net-next,03/11] net: checksum: drop the linux/uaccess.h include https://git.kernel.org/netdev/net-next/c/68f4eae781dd - [net-next,04/11] net: skbuff: drop the linux/textsearch.h include https://git.kernel.org/netdev/net-next/c/2195e2a024ae - [net-next,05/11] net: add missing includes of linux/sched/clock.h https://git.kernel.org/netdev/net-next/c/2870c4d6a5e4 - [net-next,06/11] net: skbuff: drop the linux/sched/clock.h include https://git.kernel.org/netdev/net-next/c/9ac849f2c492 - [net-next,07/11] net: skbuff: drop the linux/sched.h include https://git.kernel.org/netdev/net-next/c/422164224e32 - [net-next,08/11] net: add missing includes of linux/splice.h https://git.kernel.org/netdev/net-next/c/509f15b9c551 - [net-next,09/11] net: skbuff: drop the linux/splice.h include https://git.kernel.org/netdev/net-next/c/5255c0ca7983 - [net-next,10/11] net: skbuff: drop the linux/hrtimer.h include https://git.kernel.org/netdev/net-next/c/9dd0db2b1303 - [net-next,11/11] net: remove unnecessary includes from net/flow.h https://git.kernel.org/netdev/net-next/c/21bf73158fe7
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html