All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] sched: Factor out nr_iowait and nr_iowait_cpu
@ 2018-10-04  7:42 ` Daniel Lezcano
  0 siblings, 0 replies; 14+ messages in thread
From: Daniel Lezcano @ 2018-10-04  7:42 UTC (permalink / raw)
  To: rafael; +Cc: rjw, linux-pm, Ingo Molnar, Peter Zijlstra, open list:SCHEDULER

The function nr_iowait_cpu() can be used directly by nr_iowait() instead
of duplicating code.

Call nr_iowait_cpu() from nr_iowait()

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 kernel/sched/core.c | 40 +++++++++++++++++++---------------------
 1 file changed, 19 insertions(+), 21 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 625bc98..b88a145 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2873,6 +2873,24 @@ unsigned long long nr_context_switches(void)
 
 	return sum;
 }
+/*
+ * Consumers of these two interfaces, like for example the cpufreq menu
+ * governor are using nonsensical data. Boosting frequency for a CPU that has
+ * IO-wait which might not even end up running the task when it does become
+ * runnable.
+ */
+
+unsigned long nr_iowait_cpu(int cpu)
+{
+	return atomic_read(&cpu_rq(cpu)->nr_iowait);
+}
+
+void get_iowait_load(unsigned long *nr_waiters, unsigned long *load)
+{
+	struct rq *rq = this_rq();
+	*nr_waiters = atomic_read(&rq->nr_iowait);
+	*load = rq->load.weight;
+}
 
 /*
  * IO-wait accounting, and how its mostly bollocks (on SMP).
@@ -2909,31 +2927,11 @@ unsigned long nr_iowait(void)
 	unsigned long i, sum = 0;
 
 	for_each_possible_cpu(i)
-		sum += atomic_read(&cpu_rq(i)->nr_iowait);
+		sum += nr_iowait_cpu(i);
 
 	return sum;
 }
 
-/*
- * Consumers of these two interfaces, like for example the cpufreq menu
- * governor are using nonsensical data. Boosting frequency for a CPU that has
- * IO-wait which might not even end up running the task when it does become
- * runnable.
- */
-
-unsigned long nr_iowait_cpu(int cpu)
-{
-	struct rq *this = cpu_rq(cpu);
-	return atomic_read(&this->nr_iowait);
-}
-
-void get_iowait_load(unsigned long *nr_waiters, unsigned long *load)
-{
-	struct rq *rq = this_rq();
-	*nr_waiters = atomic_read(&rq->nr_iowait);
-	*load = rq->load.weight;
-}
-
 #ifdef CONFIG_SMP
 
 /*
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2018-10-04 17:16 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-04  7:42 [PATCH 1/2] sched: Factor out nr_iowait and nr_iowait_cpu Daniel Lezcano
2018-10-04  7:42 ` Daniel Lezcano
2018-10-04  7:42 ` [PATCH 2/2] cpuidle/drivers/menu: Remove get_loadavg in the performance multiplier Daniel Lezcano
2018-10-04  7:42   ` Daniel Lezcano
2018-10-04  7:57   ` Peter Zijlstra
2018-10-04  8:12     ` Daniel Lezcano
2018-10-04  9:35       ` Peter Zijlstra
2018-10-04  8:22   ` Rafael J. Wysocki
2018-10-04  8:40     ` Daniel Lezcano
2018-10-04  8:47       ` Rafael J. Wysocki
2018-10-04  9:36         ` Peter Zijlstra
2018-10-04  9:39           ` Rafael J. Wysocki
2018-10-04 17:16       ` Joe Perches
2018-10-04  7:46 ` [PATCH 1/2] sched: Factor out nr_iowait and nr_iowait_cpu Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.