All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched/deadline: Make update_curr_dl() more accurate
@ 2018-02-06  1:55 Wen Yang
  2018-02-06  7:26 ` Juri Lelli
  2018-02-13 11:28 ` [tip:sched/urgent] " tip-bot for Wen Yang
  0 siblings, 2 replies; 3+ messages in thread
From: Wen Yang @ 2018-02-06  1:55 UTC (permalink / raw)
  To: mingo, peterz; +Cc: linux-kernel, jiang.biao2, zhong.weidong, wen.yang99

rq->clock_task may be updated between the two calls of
rq_clock_task() in update_curr_dl(). Calling rq_clock_task() only
once makes it more accurate and efficient, taking update_curr() as
reference.

Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
Reviewed-by: Jiang Biao <jiang.biao2@zte.com.cn>
Suggested-by: Peter Zijlstra <peterz@infradead.org>
---
 kernel/sched/deadline.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 2473736..a32209c 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1115,6 +1115,7 @@ static void update_curr_dl(struct rq *rq)
 	struct task_struct *curr = rq->curr;
 	struct sched_dl_entity *dl_se = &curr->dl;
 	u64 delta_exec;
+	u64 now;
 
 	if (!dl_task(curr) || !on_dl_rq(dl_se))
 		return;
@@ -1127,7 +1128,8 @@ static void update_curr_dl(struct rq *rq)
 	 * natural solution, but the full ramifications of this
 	 * approach need further study.
 	 */
-	delta_exec = rq_clock_task(rq) - curr->se.exec_start;
+	now = rq_clock_task(rq);
+	delta_exec = now - curr->se.exec_start;
 	if (unlikely((s64)delta_exec <= 0)) {
 		if (unlikely(dl_se->dl_yielded))
 			goto throttle;
@@ -1143,7 +1145,7 @@ static void update_curr_dl(struct rq *rq)
 	curr->se.sum_exec_runtime += delta_exec;
 	account_group_exec_runtime(curr, delta_exec);
 
-	curr->se.exec_start = rq_clock_task(rq);
+	curr->se.exec_start = now;
 	cgroup_account_cputime(curr, delta_exec);
 
 	sched_rt_avg_update(rq, delta_exec);
-- 
1.8.3.1

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

* Re: [PATCH] sched/deadline: Make update_curr_dl() more accurate
  2018-02-06  1:55 [PATCH] sched/deadline: Make update_curr_dl() more accurate Wen Yang
@ 2018-02-06  7:26 ` Juri Lelli
  2018-02-13 11:28 ` [tip:sched/urgent] " tip-bot for Wen Yang
  1 sibling, 0 replies; 3+ messages in thread
From: Juri Lelli @ 2018-02-06  7:26 UTC (permalink / raw)
  To: Wen Yang; +Cc: mingo, peterz, linux-kernel, jiang.biao2, zhong.weidong

Hi,

On 06/02/18 09:55, Wen Yang wrote:
> rq->clock_task may be updated between the two calls of
> rq_clock_task() in update_curr_dl(). Calling rq_clock_task() only
> once makes it more accurate and efficient, taking update_curr() as
> reference.
> 
> Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
> Reviewed-by: Jiang Biao <jiang.biao2@zte.com.cn>
> Suggested-by: Peter Zijlstra <peterz@infradead.org>

Acked-by: Juri Lelli <juri.lelli@redhat.com>

Thanks!

- Juri

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

* [tip:sched/urgent] sched/deadline: Make update_curr_dl() more accurate
  2018-02-06  1:55 [PATCH] sched/deadline: Make update_curr_dl() more accurate Wen Yang
  2018-02-06  7:26 ` Juri Lelli
@ 2018-02-13 11:28 ` tip-bot for Wen Yang
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Wen Yang @ 2018-02-13 11:28 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, hpa, peterz, tglx, jiang.biao2, linux-kernel, torvalds,
	wen.yang99

Commit-ID:  6fe0ce1eb04f99a1eb1eb6e7f775666966cf6c80
Gitweb:     https://git.kernel.org/tip/6fe0ce1eb04f99a1eb1eb6e7f775666966cf6c80
Author:     Wen Yang <wen.yang99@zte.com.cn>
AuthorDate: Tue, 6 Feb 2018 09:55:48 +0800
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 13 Feb 2018 11:44:40 +0100

sched/deadline: Make update_curr_dl() more accurate

rq->clock_task may be updated between the two calls of
rq_clock_task() in update_curr_dl(). Calling rq_clock_task() only
once makes it more accurate and efficient, taking update_curr() as
reference.

Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Jiang Biao <jiang.biao2@zte.com.cn>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: zhong.weidong@zte.com.cn
Link: http://lkml.kernel.org/r/1517882148-44599-1-git-send-email-wen.yang99@zte.com.cn
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/deadline.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 9bb0e0c..9df0978 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1153,6 +1153,7 @@ static void update_curr_dl(struct rq *rq)
 	struct sched_dl_entity *dl_se = &curr->dl;
 	u64 delta_exec, scaled_delta_exec;
 	int cpu = cpu_of(rq);
+	u64 now;
 
 	if (!dl_task(curr) || !on_dl_rq(dl_se))
 		return;
@@ -1165,7 +1166,8 @@ static void update_curr_dl(struct rq *rq)
 	 * natural solution, but the full ramifications of this
 	 * approach need further study.
 	 */
-	delta_exec = rq_clock_task(rq) - curr->se.exec_start;
+	now = rq_clock_task(rq);
+	delta_exec = now - curr->se.exec_start;
 	if (unlikely((s64)delta_exec <= 0)) {
 		if (unlikely(dl_se->dl_yielded))
 			goto throttle;
@@ -1178,7 +1180,7 @@ static void update_curr_dl(struct rq *rq)
 	curr->se.sum_exec_runtime += delta_exec;
 	account_group_exec_runtime(curr, delta_exec);
 
-	curr->se.exec_start = rq_clock_task(rq);
+	curr->se.exec_start = now;
 	cgroup_account_cputime(curr, delta_exec);
 
 	sched_rt_avg_update(rq, delta_exec);

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

end of thread, other threads:[~2018-02-13 11:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-06  1:55 [PATCH] sched/deadline: Make update_curr_dl() more accurate Wen Yang
2018-02-06  7:26 ` Juri Lelli
2018-02-13 11:28 ` [tip:sched/urgent] " tip-bot for Wen Yang

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.