[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201119035230.45330-4-laoar.shao@gmail.com>
Date: Thu, 19 Nov 2020 11:52:29 +0800
From: Yafang Shao <laoar.shao@...il.com>
To: mingo@...hat.com, peterz@...radead.org, juri.lelli@...hat.com,
vincent.guittot@...aro.org, dietmar.eggemann@....com,
rostedt@...dmis.org, bsegall@...gle.com, mgorman@...e.de,
bristot@...hat.com
Cc: linux-kernel@...r.kernel.org, linux-rt-users@...r.kernel.org,
Yafang Shao <laoar.shao@...il.com>
Subject: [RFC PATCH 3/4] sched: define update_stats_curr_start() as a common helper
update_stats_curr_start() is used to update the exec_start when we are
starting a new run period, which is used by all sched class. So we'd
better define it as a common helper.
Signed-off-by: Yafang Shao <laoar.shao@...il.com>
---
kernel/sched/fair.c | 14 +-------------
kernel/sched/rt.c | 2 +-
kernel/sched/sched.h | 12 ++++++++++++
3 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index aba21191283d..b762cc3e165c 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -914,18 +914,6 @@ update_stats_dequeue(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
}
}
-/*
- * We are picking a new current task - update its stats:
- */
-static inline void
-update_stats_curr_start(struct cfs_rq *cfs_rq, struct sched_entity *se)
-{
- /*
- * We are starting a new run period:
- */
- se->exec_start = rq_clock_task(rq_of(cfs_rq));
-}
-
/**************************************************
* Scheduling class queueing methods:
*/
@@ -4254,7 +4242,7 @@ set_next_entity(struct cfs_rq *cfs_rq, struct sched_entity *se)
update_load_avg(cfs_rq, se, UPDATE_TG);
}
- update_stats_curr_start(cfs_rq, se);
+ update_stats_curr_start(rq_of(cfs_rq), se);
cfs_rq->curr = se;
/*
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 49ec096a8aa1..b9ec886702a1 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -1574,7 +1574,7 @@ static void check_preempt_curr_rt(struct rq *rq, struct task_struct *p, int flag
static inline void set_next_task_rt(struct rq *rq, struct task_struct *p, bool first)
{
- p->se.exec_start = rq_clock_task(rq);
+ update_stats_curr_start(rq, &p->se);
/* The running task is never eligible for pushing */
dequeue_pushable_task(rq, p);
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index e29f2375c4f5..28986736ced9 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -2642,3 +2642,15 @@ static inline struct task_struct *task_of(struct sched_entity *se)
return container_of(se, struct task_struct, se);
}
+/*
+ * We are picking a new current task - update its stats:
+ */
+static inline void
+update_stats_curr_start(struct rq *rq, struct sched_entity *se)
+{
+ /*
+ * We are starting a new run period:
+ */
+ se->exec_start = rq_clock_task(rq);
+}
+
--
2.18.4
Powered by blists - more mailing lists