All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] sched/fair: simplfy the work when reweighting entity
@ 2020-08-11 11:32 Jiang Biao
  2020-08-17 12:28 ` Dietmar Eggemann
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jiang Biao @ 2020-08-11 11:32 UTC (permalink / raw)
  To: mingo, peterz, juri.lelli, vincent.guittot
  Cc: dietmar.eggemann, rostedt, bsegall, mgorman, linux-kernel, Jiang Biao

From: Jiang Biao <benbjiang@tencent.com>

The code in reweight_entity() can be simplified.

For a sched entity on the rq, the entity accounting can be replaced by
cfs_rq instantaneous load updates currently called from within the
entity accounting.

Even though an entity on the rq can't represent a task in
reweight_entity() (a task is always dequeued before calling this
function) and so the numa task accounting and the rq->cfs_tasks list
management of the entity accounting are never called, the redundant
cfs_rq->nr_running decrement/increment will be avoided.

Signed-off-by: Jiang Biao <benbjiang@tencent.com>
---
v3<-v2: Amend commit log taking Dietmar's advice. Thx.
v2<-v1: Amend the commit log

 kernel/sched/fair.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 04fa8dbcfa4d..18a8fc7bd0de 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3086,7 +3086,7 @@ static void reweight_entity(struct cfs_rq *cfs_rq, struct sched_entity *se,
 		/* commit outstanding execution time */
 		if (cfs_rq->curr == se)
 			update_curr(cfs_rq);
-		account_entity_dequeue(cfs_rq, se);
+		update_load_sub(&cfs_rq->load, se->load.weight);
 	}
 	dequeue_load_avg(cfs_rq, se);
 
@@ -3102,7 +3102,7 @@ static void reweight_entity(struct cfs_rq *cfs_rq, struct sched_entity *se,
 
 	enqueue_load_avg(cfs_rq, se);
 	if (se->on_rq)
-		account_entity_enqueue(cfs_rq, se);
+		update_load_add(&cfs_rq->load, se->load.weight);
 
 }
 
-- 
2.21.0


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

* Re: [PATCH v3] sched/fair: simplfy the work when reweighting entity
  2020-08-11 11:32 [PATCH v3] sched/fair: simplfy the work when reweighting entity Jiang Biao
@ 2020-08-17 12:28 ` Dietmar Eggemann
  2020-08-18  9:07 ` Vincent Guittot
  2020-08-27  7:54 ` [tip: sched/core] sched/fair: Simplify " tip-bot2 for Jiang Biao
  2 siblings, 0 replies; 5+ messages in thread
From: Dietmar Eggemann @ 2020-08-17 12:28 UTC (permalink / raw)
  To: Jiang Biao, mingo, peterz, juri.lelli, vincent.guittot
  Cc: rostedt, bsegall, mgorman, linux-kernel, Jiang Biao

On 11/08/2020 13:32, Jiang Biao wrote:
> From: Jiang Biao <benbjiang@tencent.com>
> 
> The code in reweight_entity() can be simplified.
> 
> For a sched entity on the rq, the entity accounting can be replaced by
> cfs_rq instantaneous load updates currently called from within the
> entity accounting.
> 
> Even though an entity on the rq can't represent a task in
> reweight_entity() (a task is always dequeued before calling this
> function) and so the numa task accounting and the rq->cfs_tasks list
> management of the entity accounting are never called, the redundant
> cfs_rq->nr_running decrement/increment will be avoided.
> 
> Signed-off-by: Jiang Biao <benbjiang@tencent.com>
> ---
> v3<-v2: Amend commit log taking Dietmar's advice. Thx.
> v2<-v1: Amend the commit log
> 
>  kernel/sched/fair.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 04fa8dbcfa4d..18a8fc7bd0de 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -3086,7 +3086,7 @@ static void reweight_entity(struct cfs_rq *cfs_rq, struct sched_entity *se,
>  		/* commit outstanding execution time */
>  		if (cfs_rq->curr == se)
>  			update_curr(cfs_rq);
> -		account_entity_dequeue(cfs_rq, se);
> +		update_load_sub(&cfs_rq->load, se->load.weight);
>  	}
>  	dequeue_load_avg(cfs_rq, se);
>  
> @@ -3102,7 +3102,7 @@ static void reweight_entity(struct cfs_rq *cfs_rq, struct sched_entity *se,
>  
>  	enqueue_load_avg(cfs_rq, se);
>  	if (se->on_rq)
> -		account_entity_enqueue(cfs_rq, se);
> +		update_load_add(&cfs_rq->load, se->load.weight);
>  
>  }

Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com>

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

* Re: [PATCH v3] sched/fair: simplfy the work when reweighting entity
  2020-08-11 11:32 [PATCH v3] sched/fair: simplfy the work when reweighting entity Jiang Biao
  2020-08-17 12:28 ` Dietmar Eggemann
@ 2020-08-18  9:07 ` Vincent Guittot
  2020-08-18 11:34   ` peterz
  2020-08-27  7:54 ` [tip: sched/core] sched/fair: Simplify " tip-bot2 for Jiang Biao
  2 siblings, 1 reply; 5+ messages in thread
From: Vincent Guittot @ 2020-08-18  9:07 UTC (permalink / raw)
  To: Jiang Biao
  Cc: Ingo Molnar, Peter Zijlstra, Juri Lelli, Dietmar Eggemann,
	Steven Rostedt, Ben Segall, Mel Gorman, linux-kernel, Jiang Biao

On Tue, 11 Aug 2020 at 13:32, Jiang Biao <benbjiang@gmail.com> wrote:
>
> From: Jiang Biao <benbjiang@tencent.com>
>
> The code in reweight_entity() can be simplified.
>
> For a sched entity on the rq, the entity accounting can be replaced by
> cfs_rq instantaneous load updates currently called from within the
> entity accounting.
>
> Even though an entity on the rq can't represent a task in
> reweight_entity() (a task is always dequeued before calling this
> function) and so the numa task accounting and the rq->cfs_tasks list
> management of the entity accounting are never called, the redundant
> cfs_rq->nr_running decrement/increment will be avoided.
>
> Signed-off-by: Jiang Biao <benbjiang@tencent.com>

Minor typo of the subject: s/simplfy/simplify/

Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>

> ---
> v3<-v2: Amend commit log taking Dietmar's advice. Thx.
> v2<-v1: Amend the commit log
>
>  kernel/sched/fair.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 04fa8dbcfa4d..18a8fc7bd0de 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -3086,7 +3086,7 @@ static void reweight_entity(struct cfs_rq *cfs_rq, struct sched_entity *se,
>                 /* commit outstanding execution time */
>                 if (cfs_rq->curr == se)
>                         update_curr(cfs_rq);
> -               account_entity_dequeue(cfs_rq, se);
> +               update_load_sub(&cfs_rq->load, se->load.weight);
>         }
>         dequeue_load_avg(cfs_rq, se);
>
> @@ -3102,7 +3102,7 @@ static void reweight_entity(struct cfs_rq *cfs_rq, struct sched_entity *se,
>
>         enqueue_load_avg(cfs_rq, se);
>         if (se->on_rq)
> -               account_entity_enqueue(cfs_rq, se);
> +               update_load_add(&cfs_rq->load, se->load.weight);
>
>  }
>
> --
> 2.21.0
>

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

* Re: [PATCH v3] sched/fair: simplfy the work when reweighting entity
  2020-08-18  9:07 ` Vincent Guittot
@ 2020-08-18 11:34   ` peterz
  0 siblings, 0 replies; 5+ messages in thread
From: peterz @ 2020-08-18 11:34 UTC (permalink / raw)
  To: Vincent Guittot
  Cc: Jiang Biao, Ingo Molnar, Juri Lelli, Dietmar Eggemann,
	Steven Rostedt, Ben Segall, Mel Gorman, linux-kernel, Jiang Biao

On Tue, Aug 18, 2020 at 11:07:37AM +0200, Vincent Guittot wrote:
> On Tue, 11 Aug 2020 at 13:32, Jiang Biao <benbjiang@gmail.com> wrote:
> >
> > From: Jiang Biao <benbjiang@tencent.com>
> >
> > The code in reweight_entity() can be simplified.
> >
> > For a sched entity on the rq, the entity accounting can be replaced by
> > cfs_rq instantaneous load updates currently called from within the
> > entity accounting.
> >
> > Even though an entity on the rq can't represent a task in
> > reweight_entity() (a task is always dequeued before calling this
> > function) and so the numa task accounting and the rq->cfs_tasks list
> > management of the entity accounting are never called, the redundant
> > cfs_rq->nr_running decrement/increment will be avoided.
> >
> > Signed-off-by: Jiang Biao <benbjiang@tencent.com>
> 
> Minor typo of the subject: s/simplfy/simplify/

I've made it "Simplify" :-)

Thanks guys!

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

* [tip: sched/core] sched/fair: Simplify the work when reweighting entity
  2020-08-11 11:32 [PATCH v3] sched/fair: simplfy the work when reweighting entity Jiang Biao
  2020-08-17 12:28 ` Dietmar Eggemann
  2020-08-18  9:07 ` Vincent Guittot
@ 2020-08-27  7:54 ` tip-bot2 for Jiang Biao
  2 siblings, 0 replies; 5+ messages in thread
From: tip-bot2 for Jiang Biao @ 2020-08-27  7:54 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Jiang Biao, Peter Zijlstra (Intel),
	Dietmar Eggemann, Vincent Guittot, x86, LKML

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     1724b95b92979a8ea8e55a4817d05b3bb7750958
Gitweb:        https://git.kernel.org/tip/1724b95b92979a8ea8e55a4817d05b3bb7750958
Author:        Jiang Biao <benbjiang@tencent.com>
AuthorDate:    Tue, 11 Aug 2020 19:32:09 +08:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Wed, 26 Aug 2020 12:41:58 +02:00

sched/fair: Simplify the work when reweighting entity

The code in reweight_entity() can be simplified.

For a sched entity on the rq, the entity accounting can be replaced by
cfs_rq instantaneous load updates currently called from within the
entity accounting.

Even though an entity on the rq can't represent a task in
reweight_entity() (a task is always dequeued before calling this
function) and so the numa task accounting and the rq->cfs_tasks list
management of the entity accounting are never called, the redundant
cfs_rq->nr_running decrement/increment will be avoided.

Signed-off-by: Jiang Biao <benbjiang@tencent.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Link: https://lkml.kernel.org/r/20200811113209.34057-1-benbjiang@tencent.com
---
 kernel/sched/fair.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 90ebaa4..33699db 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3084,7 +3084,7 @@ static void reweight_entity(struct cfs_rq *cfs_rq, struct sched_entity *se,
 		/* commit outstanding execution time */
 		if (cfs_rq->curr == se)
 			update_curr(cfs_rq);
-		account_entity_dequeue(cfs_rq, se);
+		update_load_sub(&cfs_rq->load, se->load.weight);
 	}
 	dequeue_load_avg(cfs_rq, se);
 
@@ -3100,7 +3100,7 @@ static void reweight_entity(struct cfs_rq *cfs_rq, struct sched_entity *se,
 
 	enqueue_load_avg(cfs_rq, se);
 	if (se->on_rq)
-		account_entity_enqueue(cfs_rq, se);
+		update_load_add(&cfs_rq->load, se->load.weight);
 
 }
 

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

end of thread, other threads:[~2020-08-27  7:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-11 11:32 [PATCH v3] sched/fair: simplfy the work when reweighting entity Jiang Biao
2020-08-17 12:28 ` Dietmar Eggemann
2020-08-18  9:07 ` Vincent Guittot
2020-08-18 11:34   ` peterz
2020-08-27  7:54 ` [tip: sched/core] sched/fair: Simplify " tip-bot2 for Jiang Biao

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.