public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched/fair: Update rq clock before updating nohz cpu load
@ 2016-05-03 19:46 Matt Fleming
  2016-05-04  1:07 ` Wanpeng Li
  2016-05-05  9:42 ` [tip:sched/core] sched/fair: Update rq clock before updating nohz CPU load tip-bot for Matt Fleming
  0 siblings, 2 replies; 3+ messages in thread
From: Matt Fleming @ 2016-05-03 19:46 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra
  Cc: linux-kernel, Matt Fleming, Mike Galbraith, Mel Gorman,
	Thomas Gleixner, Frederic Weisbecker, Rik van Riel

If we're accessing rq_clock() (e.g. in sched_avg_update()) we should
update the rq clock before calling cpu_load_update(), otherwise any
time calculations will be stale.

All other paths currently call update_rq_clock().

Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Mike Galbraith <umgwanakikbuti@gmail.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Rik van Riel <riel@redhat.com>
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
---
 kernel/sched/fair.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index b8a33abce650..aa9ba82f0d7c 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4723,6 +4723,7 @@ void cpu_load_update_nohz_stop(void)
 
 	load = weighted_cpuload(cpu_of(this_rq));
 	raw_spin_lock(&this_rq->lock);
+	update_rq_clock(this_rq);
 	cpu_load_update_nohz(this_rq, curr_jiffies, load);
 	raw_spin_unlock(&this_rq->lock);
 }
-- 
2.7.3

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

* Re: [PATCH] sched/fair: Update rq clock before updating nohz cpu load
  2016-05-03 19:46 [PATCH] sched/fair: Update rq clock before updating nohz cpu load Matt Fleming
@ 2016-05-04  1:07 ` Wanpeng Li
  2016-05-05  9:42 ` [tip:sched/core] sched/fair: Update rq clock before updating nohz CPU load tip-bot for Matt Fleming
  1 sibling, 0 replies; 3+ messages in thread
From: Wanpeng Li @ 2016-05-04  1:07 UTC (permalink / raw)
  To: Matt Fleming
  Cc: Ingo Molnar, Peter Zijlstra, linux-kernel@vger.kernel.org,
	Mike Galbraith, Mel Gorman, Thomas Gleixner, Frederic Weisbecker,
	Rik van Riel

2016-05-04 3:46 GMT+08:00 Matt Fleming <matt@codeblueprint.co.uk>:
> If we're accessing rq_clock() (e.g. in sched_avg_update()) we should
> update the rq clock before calling cpu_load_update(), otherwise any
> time calculations will be stale.
>
> All other paths currently call update_rq_clock().
>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Mike Galbraith <umgwanakikbuti@gmail.com>
> Cc: Mel Gorman <mgorman@techsingularity.net>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Rik van Riel <riel@redhat.com>
> Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>

Reviewed-by: Wanpeng Li <wanpeng.li@hotmail.com>

> ---
>  kernel/sched/fair.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index b8a33abce650..aa9ba82f0d7c 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -4723,6 +4723,7 @@ void cpu_load_update_nohz_stop(void)
>
>         load = weighted_cpuload(cpu_of(this_rq));
>         raw_spin_lock(&this_rq->lock);
> +       update_rq_clock(this_rq);
>         cpu_load_update_nohz(this_rq, curr_jiffies, load);
>         raw_spin_unlock(&this_rq->lock);
>  }
> --
> 2.7.3
>



-- 
Regards,
Wanpeng Li

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

* [tip:sched/core] sched/fair: Update rq clock before updating nohz CPU load
  2016-05-03 19:46 [PATCH] sched/fair: Update rq clock before updating nohz cpu load Matt Fleming
  2016-05-04  1:07 ` Wanpeng Li
@ 2016-05-05  9:42 ` tip-bot for Matt Fleming
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Matt Fleming @ 2016-05-05  9:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: matt, torvalds, mingo, riel, mgorman, efault, peterz, hpa,
	umgwanakikbuti, wanpeng.li, linux-kernel, fweisbec, tglx

Commit-ID:  b52fad2db5d792d89975cebf2fe1646a7af28ed0
Gitweb:     http://git.kernel.org/tip/b52fad2db5d792d89975cebf2fe1646a7af28ed0
Author:     Matt Fleming <matt@codeblueprint.co.uk>
AuthorDate: Tue, 3 May 2016 20:46:54 +0100
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 5 May 2016 09:41:09 +0200

sched/fair: Update rq clock before updating nohz CPU load

If we're accessing rq_clock() (e.g. in sched_avg_update()) we should
update the rq clock before calling cpu_load_update(), otherwise any
time calculations will be stale.

All other paths currently call update_rq_clock().

Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Wanpeng Li <wanpeng.li@hotmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Mike Galbraith <umgwanakikbuti@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1462304814-11715-1-git-send-email-matt@codeblueprint.co.uk
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/fair.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 8c381a6..7a00c7c 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4724,6 +4724,7 @@ void cpu_load_update_nohz_stop(void)
 
 	load = weighted_cpuload(cpu_of(this_rq));
 	raw_spin_lock(&this_rq->lock);
+	update_rq_clock(this_rq);
 	cpu_load_update_nohz(this_rq, curr_jiffies, load);
 	raw_spin_unlock(&this_rq->lock);
 }

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

end of thread, other threads:[~2016-05-05  9:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-03 19:46 [PATCH] sched/fair: Update rq clock before updating nohz cpu load Matt Fleming
2016-05-04  1:07 ` Wanpeng Li
2016-05-05  9:42 ` [tip:sched/core] sched/fair: Update rq clock before updating nohz CPU load tip-bot for Matt Fleming

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