On Fri, Sep 11, 2026 at 05:04:06PM +0200, Petr Pavlu wrote:
> 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.
> 
> The header currently includes linux/error-injection.h to obtain the
> definition of `struct error_injection_entry`. However, this is unnecessary
> because the type is only referenced in the file as a pointer, for which an
> incomplete type is sufficient.
> 
> Remove the linux/error-injection.h include from linux/module.h and add it
> to kernel/module/main.c instead, where
> `sizeof(struct error_injection_entry)` is actually needed.
> 
> Signed-off-by: Petr Pavlu <[email protected]>
> ---
>  include/linux/module.h | 1 -
>  kernel/module/main.c   | 1 +
>  2 files changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/module.h b/include/linux/module.h
> index 96cc98568eea..b3a3d5827384 100644
> --- a/include/linux/module.h
> +++ b/include/linux/module.h
> @@ -24,7 +24,6 @@
>  #include <linux/jump_label.h>
>  #include <linux/export.h>
>  #include <linux/rbtree_latch.h>
> -#include <linux/error-injection.h>
>  #include <linux/tracepoint-defs.h>
>  #include <linux/srcu.h>
>  #include <linux/static_call_types.h>
> diff --git a/kernel/module/main.c b/kernel/module/main.c
> index d0e1e0bd2ad0..f1392c10907a 100644
> --- a/kernel/module/main.c
> +++ b/kernel/module/main.c
> @@ -60,6 +60,7 @@
>  #include <linux/codetag.h>
>  #include <linux/debugfs.h>
>  #include <linux/execmem.h>
> +#include <linux/error-injection.h>
>  #include <uapi/linux/module.h>
>  #include "internal.h"
>  
> 
> -- 
> 2.55.0

Reviewed-by: Aaron Tomlin <[email protected]>

-- 
Aaron Tomlin

Reply via email to