[PATCH 1/1] timers/nohz: fix build with CONFIG_NO_HZ_FULL warnning.
From: Yupeng Li
Date: Thu Jun 30 2022 - 23:45:48 EST
When CONFIG_NO_HZ_FULL was enabled,build kernel with Section mismatch
warnnings.Fixed this by removing the __init annotation according to
the prompt of compilation information ,some build messages as followed:
GEN .version
CHK include/generated/compile.h
UPD include/generated/compile.h
CC init/version.o
AR init/built-in.a
LD vmlinux.o
MODPOST vmlinux.symvers
WARNING: modpost: vmlinux.o(___ksymtab_gpl+tick_nohz_full_setup+0x0): Section mismatch in reference from the variable __ksymtab_tick_nohz_full_setup to the function .init.text:tick_nohz_full_setup()
The symbol tick_nohz_full_setup is exported and annotated __init
Fix this by removing the __init annotation of tick_nohz_full_setup or drop the export.
MODINFO modules.builtin.modinfo
GEN modules.builtin
LD .tmp_vmlinux.kallsyms1
Signed-off-by: Yupeng Li <liyupeng@xxxxxxxxxx>
Reviewed-by: Caicai <caizp2008@xxxxxxx>
---
include/linux/tick.h | 2 +-
kernel/time/tick-sched.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/tick.h b/include/linux/tick.h
index bfd571f18cfd..63fe21c6a55c 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -272,7 +272,7 @@ static inline void tick_dep_clear_signal(struct signal_struct *signal,
extern void tick_nohz_full_kick_cpu(int cpu);
extern void __tick_nohz_task_switch(void);
-extern void __init tick_nohz_full_setup(cpumask_var_t cpumask);
+extern void tick_nohz_full_setup(cpumask_var_t cpumask);
#else
static inline bool tick_nohz_full_enabled(void) { return false; }
static inline bool tick_nohz_full_cpu(int cpu) { return false; }
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 58a11f859ac7..f8641c66f0d8 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -520,7 +520,7 @@ void __tick_nohz_task_switch(void)
}
/* Get the boot-time nohz CPU list from the kernel parameters. */
-void __init tick_nohz_full_setup(cpumask_var_t cpumask)
+void tick_nohz_full_setup(cpumask_var_t cpumask)
{
alloc_bootmem_cpumask_var(&tick_nohz_full_mask);
cpumask_copy(tick_nohz_full_mask, cpumask);
--
2.34.1