mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sched: nohz: drop calc_load_nohz_remote with mismatched ifdefs
@ 2020-07-02  0:49 Paul Gortmaker
  0 siblings, 0 replies; only message in thread
From: Paul Gortmaker @ 2020-07-02  0:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Paul Gortmaker, Scott Wood, Peter Zijlstra, Frederic Weisbecker,
	Ingo Molnar

In commit ebc0f83c78a2 ("timers/nohz: Update NOHZ load in remote tick")
we got calc_load_nohz_remote(rq) as a one-line wrapper function around
calc_load_nohz_fold(rq) and with sched_tick_remote() as the only user.

However, we build the sched_tick_remote only for NO_HZ_FULL but the
wrapper inside a block for NO_HZ_COMMON.  So users that parallel the
defconfig with COMMON=y and FULL=n get an unused stub built in.

  (gdb) p calc_load_nohz_remote
  $227 = {void (struct rq *)} 0xffffffff8110a5c0 <calc_load_nohz_remote>
  (gdb) p sched_tick_remote
  No symbol "sched_tick_remote" in current context.

Rather than fix the ifdeffery, we note that calc_load_nohz_remote was
most likely introduced to be self-documenting of the "remote" aspect.

And yet, inside sched_tick_remote, it is fairly clear that all the code
there are acting on behalf of the remote cpu and the corresponding
remote rq without them each adding specific remote named wrappers.

Hence it seems to make sense to just dispense with the stub entirely
and simplify the code code in the process.

Ensure at the same time, that nohz.h is aware of what a rq is - since
that implicit header dependency was introduced by the same commit.

Fixes: ebc0f83c78a2 ("timers/nohz: Update NOHZ load in remote tick")
Cc: Scott Wood <swood@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 include/linux/sched/nohz.h |  5 +++--
 kernel/sched/core.c        |  2 +-
 kernel/sched/loadavg.c     | 11 +----------
 3 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/include/linux/sched/nohz.h b/include/linux/sched/nohz.h
index 6d67e9a5af6b..58459fdf6758 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);
@@ -15,11 +17,10 @@ static inline void nohz_balance_enter_idle(int cpu) { }
 
 #ifdef CONFIG_NO_HZ_COMMON
 void calc_load_nohz_start(void);
-void calc_load_nohz_remote(struct rq *rq);
 void calc_load_nohz_stop(void);
+void calc_load_nohz_fold(struct rq *rq);
 #else
 static inline void calc_load_nohz_start(void) { }
-static inline void calc_load_nohz_remote(struct rq *rq) { }
 static inline void calc_load_nohz_stop(void) { }
 #endif /* CONFIG_NO_HZ_COMMON */
 
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index f518af52d0fb..23d3b2282c09 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3763,7 +3763,7 @@ static void sched_tick_remote(struct work_struct *work)
 	}
 	curr->sched_class->task_tick(rq, curr, 0);
 
-	calc_load_nohz_remote(rq);
+	calc_load_nohz_fold(rq);
 out_unlock:
 	rq_unlock_irq(rq, &rf);
 out_requeue:
diff --git a/kernel/sched/loadavg.c b/kernel/sched/loadavg.c
index d2a655643a02..5bab95e1bde4 100644
--- a/kernel/sched/loadavg.c
+++ b/kernel/sched/loadavg.c
@@ -231,7 +231,7 @@ static inline int calc_load_read_idx(void)
 	return calc_load_idx & 1;
 }
 
-static void calc_load_nohz_fold(struct rq *rq)
+void calc_load_nohz_fold(struct rq *rq)
 {
 	long delta;
 
@@ -252,15 +252,6 @@ void calc_load_nohz_start(void)
 	calc_load_nohz_fold(this_rq());
 }
 
-/*
- * Keep track of the load for NOHZ_FULL, must be called between
- * calc_load_nohz_{start,stop}().
- */
-void calc_load_nohz_remote(struct rq *rq)
-{
-	calc_load_nohz_fold(rq);
-}
-
 void calc_load_nohz_stop(void)
 {
 	struct rq *this_rq = this_rq();
-- 
1.9.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-07-02  0:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-02  0:49 [PATCH] sched: nohz: drop calc_load_nohz_remote with mismatched ifdefs Paul Gortmaker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome