Bring includes in linux/kmod.h up to date
Subsystems (28)
Petr Pavlu
maintainerv3 cover Bring includes in linux/kmod.h up to date
The usermode helper declarations were previously provided by linux/kmod.h but commit c1f3fa2a4fde ("kmod: split off umh headers into its own file") moved them to linux/umh.h in 2017. Add explicit includes of linux/umh.h to files that use usermode helpers and remove linux/kmod.h where it is no longer needed.
Also add a missing include of linux/sysctl.h to kernel/time/jiffies.c.
Finally, clean up linux/kmod.h so that it includes only the headers that it actually requires, importantly removing the compat linux/umh.h include.
This cleanup is motivated by trying to reduce the preprocessed size of linux/module.h, which includes linux/kmod.h. linux/module.h appears in roughly 15k #include directives across the kernel. This makes it a "hot" header, so it should avoid pulling in unnecessary definitions. Note that this series doesn't immediately improve the situation, since most of the files included by linux/kmod.h are, for now, also included by linux/module.h through other paths.
Apologies for the wide distribution. Acked-bys are appreciated.
---
Changes in v3:
- Rebase on top of v7.3-rc2.
- Clean up commit descriptions.
- Link to v2: https://patch.msgid.link/[email protected]
Changes in v2:
- Remove the linux/kmod.h include from kernel/cgroup/cgroup-v1.c.
- Add a missing include of linux/sysctl.h to kernel/time/jiffies.c.
- Link to v1: https://patch.msgid.link/[email protected]
---
Petr Pavlu (3):
umh, treewide: Explicitly include linux/umh.h where needed time/jiffies: Include linux/sysctl.h for proc_int_u2k_conv_uop(), ...
module: Bring includes in linux/kmod.h up to date
arch/x86/kernel/cpu/mce/dev-mcelog.c | 2 +- drivers/block/drbd/drbd_nl.c | 1 + drivers/greybus/svc_watchdog.c | 1 + drivers/macintosh/windfarm_core.c | 1 + drivers/pnp/pnpbios/core.c | 2 +- drivers/video/fbdev/uvesafb.c | 1 + fs/coredump.c | 2 +- fs/nfs/cache_lib.c | 2 +- fs/nfsd/nfs4layouts.c | 2 +- fs/nfsd/nfs4recover.c | 1 + fs/ocfs2/stackglue.c | 1 + include/linux/kmod.h | 12 ++---------- kernel/cgroup/cgroup-v1.c | 2 +- kernel/module/kmod.c | 1 + kernel/power/process.c | 2 +- kernel/reboot.c | 2 +- kernel/time/jiffies.c | 1 + kernel/umh.c | 2 +- lib/kobject_uevent.c | 2 +- net/bridge/br_stp_if.c | 2 +- security/keys/request_key.c | 2 +- security/tomoyo/common.h | 2 +- 22 files changed, 23 insertions(+), 23 deletions(-)
---
base-commit: df2908090cda368b01ff43709f51890076c56157
change-id: 20260816-module-include-kmod-14d1a0e19462
Petr Pavlu
maintainerPATCH v3 1/3 umh, treewide: Explicitly include linux/umh.h where needed
The usermode helper declarations were previously provided by linux/kmod.h but commit c1f3fa2a4fde ("kmod: split off umh headers into its own file") moved them to linux/umh.h in 2017.
Add explicit includes of linux/umh.h to files that use usermode helpers and remove linux/kmod.h where it is no longer needed.
--- arch/x86/kernel/cpu/mce/dev-mcelog.c | 2 +- drivers/block/drbd/drbd_nl.c | 1 + drivers/greybus/svc_watchdog.c | 1 + drivers/macintosh/windfarm_core.c | 1 + drivers/pnp/pnpbios/core.c | 2 +- drivers/video/fbdev/uvesafb.c | 1 + fs/coredump.c | 2 +- fs/nfs/cache_lib.c | 2 +- fs/nfsd/nfs4layouts.c | 2 +- fs/nfsd/nfs4recover.c | 1 + fs/ocfs2/stackglue.c | 1 + kernel/cgroup/cgroup-v1.c | 2 +- kernel/module/kmod.c | 1 + kernel/power/process.c | 2 +- kernel/reboot.c | 2 +- kernel/umh.c | 2 +- lib/kobject_uevent.c | 2 +- net/bridge/br_stp_if.c | 2 +- security/keys/request_key.c | 2 +- security/tomoyo/common.h | 2 +- 20 files changed, 20 insertions(+), 13 deletions(-)
arch/x86/kernel/cpu/mce/dev-mcelog.c +1 -1
@@ -11,7 +11,7 @@#include <linux/miscdevice.h> #include <linux/slab.h> -#include <linux/kmod.h> +#include <linux/umh.h> #include <linux/poll.h> #include "internal.h"
drivers/block/drbd/drbd_nl.c +1 -0
@@ -14,6 +14,7 @@#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt#include <linux/module.h> +#include <linux/umh.h> #include <linux/drbd.h> #include <linux/in.h> #include <linux/fs.h>
drivers/greybus/svc_watchdog.c +1 -0
@@ -7,6 +7,7 @@#include <linux/delay.h> #include <linux/suspend.h> +#include <linux/umh.h> #include <linux/workqueue.h> #include <linux/greybus.h>
drivers/macintosh/windfarm_core.c +1 -0
@@ -34,6 +34,7 @@#include <linux/platform_device.h> #include <linux/mutex.h> #include <linux/freezer.h> +#include <linux/umh.h> #include "windfarm.h"
drivers/pnp/pnpbios/core.c +1 -1
@@ -47,7 +47,7 @@#include <linux/delay.h> #include <linux/acpi.h> #include <linux/freezer.h> -#include <linux/kmod.h> +#include <linux/umh.h> #include <linux/kthread.h> #include <asm/page.h>
drivers/video/fbdev/uvesafb.c +1 -0
@@ -23,6 +23,7 @@#include <linux/io.h> #include <linux/mutex.h> #include <linux/slab.h> +#include <linux/umh.h> #include <video/edid.h> #include <video/uvesafb.h> #ifdef CONFIG_X86
fs/coredump.c +1 -1
@@ -32,7 +32,7 @@#include <linux/tsacct_kern.h> #include <linux/cn_proc.h> #include <linux/audit.h> -#include <linux/kmod.h> +#include <linux/umh.h> #include <linux/fsnotify.h> #include <linux/fs_struct.h> #include <linux/pipe_fs_i.h>
fs/nfs/cache_lib.c +1 -1
@@ -6,7 +6,7 @@* * Copyright (c) 2009 Trond Myklebust <[email protected]> */ -#include <linux/kmod.h> +#include <linux/umh.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/mount.h>
fs/nfsd/nfs4layouts.c +1 -1
@@ -3,7 +3,7 @@* Copyright (c) 2014 Christoph Hellwig. */ #include <linux/exportfs_block.h> -#include <linux/kmod.h> +#include <linux/umh.h> #include <linux/file.h> #include <linux/jhash.h> #include <linux/sched.h>
fs/nfsd/nfs4recover.c +1 -0
@@ -41,6 +41,7 @@#include <linux/fs.h> #include <linux/hex.h> #include <linux/module.h> +#include <linux/umh.h> #include <net/net_namespace.h> #include <linux/sunrpc/rpc_pipe_fs.h> #include <linux/sunrpc/clnt.h>
fs/ocfs2/stackglue.c +1 -0
@@ -18,6 +18,7 @@#include <linux/kobject.h> #include <linux/sysfs.h> #include <linux/sysctl.h> +#include <linux/umh.h> #include "ocfs2_fs.h"
kernel/cgroup/cgroup-v1.c +1 -1
@@ -2,7 +2,7 @@#include "cgroup-internal.h" #include <linux/ctype.h> -#include <linux/kmod.h> +#include <linux/umh.h> #include <linux/sort.h> #include <linux/delay.h> #include <linux/mm.h>
kernel/module/kmod.c +1 -0
@@ -28,6 +28,7 @@#include <linux/ptrace.h> #include <linux/async.h> #include <linux/uaccess.h> +#include <linux/umh.h> #include <trace/events/module.h> #include "internal.h"
kernel/power/process.c +1 -1
@@ -16,7 +16,7 @@#include <linux/freezer.h> #include <linux/delay.h> #include <linux/workqueue.h> -#include <linux/kmod.h> +#include <linux/umh.h> #include <trace/events/power.h> #include <linux/cpuset.h>
kernel/reboot.c +1 -1
@@ -11,13 +11,13 @@#include <linux/ctype.h> #include <linux/export.h> #include <linux/kexec.h> -#include <linux/kmod.h> #include <linux/kmsg_dump.h> #include <linux/reboot.h> #include <linux/suspend.h> #include <linux/syscalls.h> #include <linux/syscore_ops.h> #include <linux/uaccess.h> +#include <linux/umh.h> /* * this indicates whether you can reboot with ctrl-alt-del: the default is yes
kernel/umh.c +1 -1
@@ -8,7 +8,7 @@#include <linux/binfmts.h> #include <linux/syscalls.h> #include <linux/unistd.h> -#include <linux/kmod.h> +#include <linux/umh.h> #include <linux/slab.h> #include <linux/completion.h> #include <linux/cred.h>
lib/kobject_uevent.c +1 -1
@@ -17,7 +17,7 @@#include <linux/string.h> #include <linux/kobject.h> #include <linux/export.h> -#include <linux/kmod.h> +#include <linux/umh.h> #include <linux/slab.h> #include <linux/socket.h> #include <linux/skbuff.h>
net/bridge/br_stp_if.c +1 -1
@@ -8,7 +8,7 @@*/ #include <linux/kernel.h> -#include <linux/kmod.h> +#include <linux/umh.h> #include <linux/etherdevice.h> #include <linux/rtnetlink.h> #include <net/switchdev.h>
security/keys/request_key.c +1 -1
@@ -9,7 +9,7 @@#include <linux/export.h> #include <linux/sched.h> -#include <linux/kmod.h> +#include <linux/umh.h> #include <linux/err.h> #include <linux/keyctl.h> #include <linux/slab.h>
security/tomoyo/common.h +1 -1
@@ -16,7 +16,7 @@#include <linux/string.h> #include <linux/mm.h> #include <linux/file.h> -#include <linux/kmod.h> +#include <linux/umh.h> #include <linux/fs.h> #include <linux/sched.h> #include <linux/namei.h>
Signature · 1 line
2.55.0
Petr Pavlu
maintainerPATCH v3 2/3 time/jiffies: Include linux/sysctl.h for proc_int_u2k_conv_uop(), ...
In reply to Petr Pavlujiffies.c uses proc_int_u2k_conv_uop(), proc_int_k2u_conv_kop(), proc_int_conv(), proc_dointvec_conv() and proc_doulongvec_minmax_conv(), which are declared in linux/sysctl.h. It currently gets that header indirectly through linux/module.h -> linux/kmod.h, but the latter no longer needs to include linux/sysctl.h.
Include linux/sysctl.h directly in jiffies.c ahead of removing the unnecessary include from linux/kmod.h.
--- kernel/time/jiffies.c | 1 + 1 file changed, 1 insertion(+)
kernel/time/jiffies.c +1 -0
@@ -8,6 +8,7 @@#include <linux/jiffies.h> #include <linux/module.h> #include <linux/init.h> +#include <linux/sysctl.h> #include "timekeeping.h" #include "tick-internal.h"
Signature · 1 line
2.55.0
Petr Pavlu
maintainerPATCH v3 3/3 module: Bring includes in linux/kmod.h up to date
In reply to Petr PavluIncluding linux/kmod.h alone results in 1.5 MB of preprocessed output, even though it provides only a few functions and macros.
The header currently depends on:
* __printf() -> linux/compiler_attributes.h,
* ENOSYS -> linux/errno.h,
* bool -> linux/types.h.
Include only these files, reducing the preprocessed output to 10 kB.
--- include/linux/kmod.h | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
include/linux/kmod.h +2 -10
@@ -2,17 +2,9 @@#ifndef __LINUX_KMOD_H__#define __LINUX_KMOD_H__ -/* -* include/linux/kmod.h -*/ - -#include <linux/umh.h> -#include <linux/gfp.h> -#include <linux/stddef.h> +#include <linux/compiler_attributes.h> #include <linux/errno.h> -#include <linux/compiler.h> -#include <linux/workqueue.h> -#include <linux/sysctl.h> +#include <linux/types.h> #ifdef CONFIG_MODULES /* modprobe exit status on success, -ve on error. Return value
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH v3 2/3] time/jiffies: Include linux/sysctl.h for proc_int_u2k_conv_uop(), ...
In reply to Petr PavluSashiko has reviewed this patch and found no issues. It looks great!
Quoted 10 lines
jiffies.cusesproc_int_u2k_conv_uop(),proc_int_k2u_conv_kop(),proc_int_conv(),proc_dointvec_conv()andproc_doulongvec_minmax_conv(), which are declared inlinux/sysctl.h. It currently gets that header indirectly throughlinux/module.h->linux/kmod.h, but the latter no longer needs to includelinux/sysctl.h.Include
linux/sysctl.hdirectly injiffies.cahead of removing the unnecessary include fromlinux/kmod.h.Signed-off-by Petr Pavlu <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
[email protected]
AI reviewRe: [PATCH v3 3/3] module: Bring includes in linux/kmod.h up to date
In reply to Petr PavluSashiko has reviewed this patch and found no issues. It looks great!
Quoted 5 lines
Including
linux/kmod.halone results in 1.5 MB of preprocessed output, even though it provides only a few functions and macros.The header currently depends on:
Quoted 7 lines
*
__printf()->linux/compiler_attributes.h,
* ENOSYS ->linux/errno.h,
* bool ->linux/types.h.Include only these files, reducing the preprocessed output to 10 kB.
Signed-off-by Petr Pavlu <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
[email protected]
AI reviewRe: [PATCH v3 1/3] umh, treewide: Explicitly include linux/umh.h where needed
In reply to Petr PavluSashiko has reviewed this patch and found no issues. It looks great!
Quoted 8 lines
The usermode helper declarations were previously provided by
linux/kmod.hbut commitc1f3fa2a4fde("kmod: split off umh headers into its own file") moved them tolinux/umh.hin 2017.Add explicit includes of
linux/umh.hto files that use usermode helpers and removelinux/kmod.hwhere it is no longer needed.Signed-off-by Petr Pavlu <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Petr Pavlu
maintainerQuoted 19 lines · Petr Pavlu
The usermode helper declarations were previously provided by
linux/kmod.hbut commitc1f3fa2a4fde("kmod: split off umh headers into its own file") moved them tolinux/umh.hin 2017. Add explicit includes oflinux/umh.hto files that use usermode helpers and removelinux/kmod.hwhere it is no longer needed.Also add a missing include of
linux/sysctl.htokernel/time/jiffies.c.Finally, clean up
linux/kmod.hso that it includes only the headers that it actually requires, importantly removing the compatlinux/umh.hinclude.This cleanup is motivated by trying to reduce the preprocessed size of
linux/module.h, which includeslinux/kmod.h.linux/module.happears in roughly 15k #include directives across the kernel. This makes it a "hot" header, so it should avoid pulling in unnecessary definitions. Note that this series doesn't immediately improve the situation, since most of the files included bylinux/kmod.hare, for now, also included bylinux/module.hthrough other paths.
Quoted 1 line
Apologies for the wide distribution. Acked-bys are appreciated.
I've queued the series on modules-next for 7.4-rc1.
Signature · 2 lines
Thanks, Petr
Re: [PATCH v3 1/3] umh, treewide: Explicitly include linux/umh.h where needed
In reply to Petr PavluQuoted 4 lines · Petr Pavlu
The usermode helper declarations were previously provided by
linux/kmod.hbut commitc1f3fa2a4fde("kmod: split off umh headers into its own file") moved them tolinux/umh.hin 2017.
Quoted 8 lines
Add explicit includes of
linux/umh.hto files that use usermode helpers and removelinux/kmod.hwhere it is no longer needed.Signed-off-by Petr Pavlu <[email protected]>--- arch/x86/kernel/cpu/mce/dev-mcelog.c | 2 +- drivers/block/drbd/drbd_nl.c | 1 + drivers/greybus/svc_watchdog.c | 1 +
For Greybus:
Quoted 49 lines
drivers/macintosh/windfarm_core.c | 1 + drivers/pnp/pnpbios/core.c | 2 +- drivers/video/fbdev/uvesafb.c | 1 + fs/coredump.c | 2 +- fs/nfs/cache_lib.c | 2 +- fs/nfsd/nfs4layouts.c | 2 +- fs/nfsd/nfs4recover.c | 1 + fs/ocfs2/stackglue.c | 1 + kernel/cgroup/cgroup-v1.c | 2 +- kernel/module/kmod.c | 1 + kernel/power/process.c | 2 +- kernel/reboot.c | 2 +- kernel/umh.c | 2 +- lib/kobject_uevent.c | 2 +- net/bridge/br_stp_if.c | 2 +- security/keys/request_key.c | 2 +- security/tomoyo/common.h | 2 +- 20 files changed, 20 insertions(+), 13 deletions(-)arch/x86/kernel/cpu/mce/dev-mcelog.c +1
-1@@ -11,7 +11,7 @@#include <linux/miscdevice.h> #include <linux/slab.h> -#include <linux/kmod.h> +#include <linux/umh.h> #include <linux/poll.h> #include "internal.h" drivers/block/drbd/drbd_nl.c +1
-0@@ -14,6 +14,7 @@#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt#include <linux/module.h> +#include <linux/umh.h> #include <linux/drbd.h> #include <linux/in.h> #include <linux/fs.h> drivers/greybus/svc_watchdog.c +0
-0
drivers/greybus/svc_watchdog.c line 13
Quoted 7 lines
drivers/greybus/svc_watchdog.c +1
-0@@ -7,6 +7,7 @@#include <linux/delay.h> #include <linux/suspend.h> +#include <linux/umh.h> #include <linux/workqueue.h> #include <linux/greybus.h>
. . .