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....@linaro.org>
---
 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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to