[RFC PATCH 4/4] sched/nohz_full: give correct cpu load for nohz_full cpu

From: Alex Shi
Date: Fri Nov 22 2013 - 01:38:13 EST


When a nohz_full cpu in tickless mode, it may update cpu_load in
following chain:
__tick_nohz_full_check
tick_nohz_restart_sched_tick
update_cpu_load_nohz
then it will be set a incorrect cpu_load: 0.
This patch try to fix it and give it the correct cpu_load value.

Signed-off-by: Alex Shi <alex.shi@xxxxxxxxxx>
---
kernel/sched/proc.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/proc.c b/kernel/sched/proc.c
index 057bb9b..5058e6a 100644
--- a/kernel/sched/proc.c
+++ b/kernel/sched/proc.c
@@ -477,10 +477,16 @@ void update_cpu_load_nohz(void)
if (pending_updates) {
this_rq->last_load_update_tick = curr_jiffies;
/*
- * We were idle, this means load 0, the current load might be
- * !0 due to remote wakeups and the sort.
+ * We may has one task and in NO_HZ_FULL, then use normal
+ * cfs load.
+ * Or we were idle, this means load 0, the current load might
+ * be !0 due to remote wakeups and the sort.
*/
- __update_cpu_load(this_rq, 0);
+ if (this_rq->cfs.h_nr_running) {
+ unsigned load = get_rq_runnable_load(this_rq);
+ __update_cpu_load(this_rq, load);
+ } else
+ __update_cpu_load(this_rq, 0);
}
raw_spin_unlock(&this_rq->lock);
}
--
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/