2020-05-14 16:43:24

by Paul Gortmaker

[permalink] [raw]
Subject: [PATCH] timers/nohz: fix implicit dependency on "struct rq"

Backports to older v5.x kernels revealed a recently introduced
implicit dependency on struct rq that makes the nohz.h header
no longer stand alone. This is most easily demonstrated as:

$ echo '#include <linux/sched/nohz.h>' > init/main.c
$ echo 'void foo(void) {}' >> init/main.c
$ make init/main.o
CC init/main.o
In file included from init/main.c:1:0:
./include/linux/sched/nohz.h:18:35: warning: ‘struct rq’ declared inside parameter list [enabled by default]
void calc_load_nohz_remote(struct rq *rq);
^
./include/linux/sched/nohz.h:18:35: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]

Fixes: ebc0f83c78a2 ("timers/nohz: Update NOHZ load in remote tick")
Cc: Peter Zijlstra <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Ingo Molnar <[email protected]>
Signed-off-by: Paul Gortmaker <[email protected]>
---
include/linux/sched/nohz.h | 2 ++
1 file changed, 2 insertions(+)

diff --git a/include/linux/sched/nohz.h b/include/linux/sched/nohz.h
index 6d67e9a5af6b..67a105b3dd82 100644
--- a/include/linux/sched/nohz.h
+++ b/include/linux/sched/nohz.h
@@ -6,6 +6,8 @@
* This is the interface between the scheduler and nohz/dynticks:
*/

+struct rq;
+
#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON)
extern void nohz_balance_enter_idle(int cpu);
extern int get_nohz_timer_target(void);
--
1.9.1