From: Hui Su <sh_def@163.com>
To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
bristot@redhat.com, linux-kernel@vger.kernel.org
Subject: [PATCH] sched/deadline: use rq_of_se intead of dl_rq_of_se and rq_of_dl_rq
Date: Thu, 22 Oct 2020 23:37:49 +0800 [thread overview]
Message-ID: <20201022153749.GA290282@rlk> (raw)
To get the rq from dl_se in the old way:
first use dl_rq_of_se() get dl_rq, then use rq_of_dl_rq() get rq,
dl_rq_of_se(): dl_se ==> p ==> rq ==> dl
rq_of_dl_rq(): dl
||
rq <==
rq_of_dl_rq(dl_rq_of_se()):
dl_se ==> p ==> rq ==> dl
||
rq <==
it looks a little redundant.
So add rq_of_se(dl_se) to instead of rq_of_dl_rq(dl_rq_of_se(dl_se)).
rq_of_se(): dl_se ==> p ==> rq
Signed-off-by: Hui Su <sh_def@163.com>
---
kernel/sched/deadline.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 6d93f4518734..b242bbf61b21 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -30,10 +30,16 @@ static inline struct rq *rq_of_dl_rq(struct dl_rq *dl_rq)
return container_of(dl_rq, struct rq, dl);
}
-static inline struct dl_rq *dl_rq_of_se(struct sched_dl_entity *dl_se)
+static inline struct rq *rq_of_se(struct sched_dl_entity *dl_se)
{
struct task_struct *p = dl_task_of(dl_se);
- struct rq *rq = task_rq(p);
+
+ return task_rq(p);
+}
+
+static inline struct dl_rq *dl_rq_of_se(struct sched_dl_entity *dl_se)
+{
+ struct rq *rq = rq_of_se(dl_se);
return &rq->dl;
}
@@ -695,8 +701,8 @@ static void check_preempt_curr_dl(struct rq *rq, struct task_struct *p, int flag
*/
static inline void setup_new_dl_entity(struct sched_dl_entity *dl_se)
{
- struct dl_rq *dl_rq = dl_rq_of_se(dl_se);
- struct rq *rq = rq_of_dl_rq(dl_rq);
+ struct rq *rq = rq_of_se(dl_se);
+
WARN_ON(dl_se->dl_boosted);
WARN_ON(dl_time_before(rq_clock(rq), dl_se->deadline));
@@ -739,8 +745,7 @@ static inline void setup_new_dl_entity(struct sched_dl_entity *dl_se)
static void replenish_dl_entity(struct sched_dl_entity *dl_se,
struct sched_dl_entity *pi_se)
{
- struct dl_rq *dl_rq = dl_rq_of_se(dl_se);
- struct rq *rq = rq_of_dl_rq(dl_rq);
+ struct rq *rq = rq_of_se(dl_se);
BUG_ON(pi_se->dl_runtime <= 0);
@@ -925,8 +930,7 @@ static inline bool dl_is_implicit(struct sched_dl_entity *dl_se)
static void update_dl_entity(struct sched_dl_entity *dl_se,
struct sched_dl_entity *pi_se)
{
- struct dl_rq *dl_rq = dl_rq_of_se(dl_se);
- struct rq *rq = rq_of_dl_rq(dl_rq);
+ struct rq *rq = rq_of_se(dl_se);
if (dl_time_before(dl_se->deadline, rq_clock(rq)) ||
dl_entity_overflow(dl_se, pi_se, rq_clock(rq))) {
@@ -1152,7 +1156,7 @@ void init_dl_task_timer(struct sched_dl_entity *dl_se)
static inline void dl_check_constrained_dl(struct sched_dl_entity *dl_se)
{
struct task_struct *p = dl_task_of(dl_se);
- struct rq *rq = rq_of_dl_rq(dl_rq_of_se(dl_se));
+ struct rq *rq = rq_of_se(dl_se);
if (dl_time_before(dl_se->deadline, rq_clock(rq)) &&
dl_time_before(rq_clock(rq), dl_next_period(dl_se))) {
@@ -1497,8 +1501,7 @@ enqueue_dl_entity(struct sched_dl_entity *dl_se,
} else if (flags & ENQUEUE_REPLENISH) {
replenish_dl_entity(dl_se, pi_se);
} else if ((flags & ENQUEUE_RESTORE) &&
- dl_time_before(dl_se->deadline,
- rq_clock(rq_of_dl_rq(dl_rq_of_se(dl_se))))) {
+ dl_time_before(dl_se->deadline, rq_clock(rq_of_se(dl_se)))) {
setup_new_dl_entity(dl_se);
}
--
2.25.1
reply other threads:[~2020-10-22 15:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201022153749.GA290282@rlk \
--to=sh_def@163.com \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox