lkml.org 
[lkml]   [2020]   [Aug]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH RFC v2] sched/fair: simplify the work when reweighting entity
Date
From: Jiang Biao <benbjiang@tencent.com>

If a se is on_rq when reweighting entity, all we need should be
updating the load of cfs_rq, other dequeue/enqueue work could be
redundant, such as,
* nr_running--/nr_running++

Even though the following dequeue/enqueue path would never be reached
* account_numa_dequeue/account_numa_enqueue
* list_del/list_add from/into cfs_tasks
but it could be a little confusing.

Simplifying the logic could be helpful to reduce a litte overhead for
hot path, and make it cleaner and more readable.

Signed-off-by: Jiang Biao <benbjiang@tencent.com>
---
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
\
 
 \ /
  Last update: 2020-08-06 19:00    [W:0.105 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site