[Devel] [PATCH RH9 07/12] sched: Split task_h_load()

Alexander Mikhalitsyn alexander.mikhalitsyn at virtuozzo.com
Thu Sep 23 14:31:31 MSK 2021


From: Kirill Tkhai <ktkhai at virtuozzo.com>

Refactoring needed for CONFIG_CFS_CPULIMIT.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>

https://jira.sw.ru/browse/PSBM-133986

(cherry picked from commit f511f958d4294fe50e1b42661a5bd7012b61f82a)
Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalitsyn at virtuozzo.com>
---
 kernel/sched/fair.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index fb32b3480e19..fb30663db2fe 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -8193,12 +8193,12 @@ static void update_cfs_rq_h_load(struct cfs_rq *cfs_rq)
 	}
 }
 
-static unsigned long task_h_load(struct task_struct *p)
+static unsigned long entity_h_load(struct sched_entity *se)
 {
-	struct cfs_rq *cfs_rq = task_cfs_rq(p);
+	struct cfs_rq *cfs_rq = cfs_rq_of(se);
 
 	update_cfs_rq_h_load(cfs_rq);
-	return div64_ul(p->se.avg.load_avg * cfs_rq->h_load,
+	return div64_ul(se->avg.load_avg * cfs_rq->h_load,
 			cfs_rq_load_avg(cfs_rq) + 1);
 }
 #else
@@ -8214,12 +8214,17 @@ static bool __update_blocked_fair(struct rq *rq, bool *done)
 	return decayed;
 }
 
-static unsigned long task_h_load(struct task_struct *p)
+static unsigned long entity_h_load(struct sched_entity *se)
 {
-	return p->se.avg.load_avg;
+	return se->avg.load_avg;
 }
 #endif
 
+static unsigned long task_h_load(struct task_struct *p)
+{
+	return entity_h_load(&p->se);
+}
+
 static void update_blocked_averages(int cpu)
 {
 	bool decayed = false, done = true;
-- 
2.31.1



More information about the Devel mailing list