From: Yajun Deng <yajun.deng@linux.dev>
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, vschneid@redhat.com
Cc: linux-kernel@vger.kernel.org, Yajun Deng <yajun.deng@linux.dev>
Subject: [PATCH] sched/fair: Remove max_vruntime() and min_vruntime()
Date: Thu, 27 Oct 2022 09:53:51 +0800 [thread overview]
Message-ID: <20221027015351.2511149-1-yajun.deng@linux.dev> (raw)
There is no need to write max_vruntime() and min_vruntime() functions,
we can use max_t() and min_t() instead.
Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
---
kernel/sched/fair.c | 24 +++---------------------
1 file changed, 3 insertions(+), 21 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index e4a0b8bd941c..bba8e0c43d59 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -562,24 +562,6 @@ void account_cfs_rq_runtime(struct cfs_rq *cfs_rq, u64 delta_exec);
* Scheduling class tree data structure manipulation methods:
*/
-static inline u64 max_vruntime(u64 max_vruntime, u64 vruntime)
-{
- s64 delta = (s64)(vruntime - max_vruntime);
- if (delta > 0)
- max_vruntime = vruntime;
-
- return max_vruntime;
-}
-
-static inline u64 min_vruntime(u64 min_vruntime, u64 vruntime)
-{
- s64 delta = (s64)(vruntime - min_vruntime);
- if (delta < 0)
- min_vruntime = vruntime;
-
- return min_vruntime;
-}
-
static inline bool entity_before(struct sched_entity *a,
struct sched_entity *b)
{
@@ -609,12 +591,12 @@ static void update_min_vruntime(struct cfs_rq *cfs_rq)
if (!curr)
vruntime = se->vruntime;
else
- vruntime = min_vruntime(vruntime, se->vruntime);
+ vruntime = min_t(u64, vruntime, se->vruntime);
}
/* ensure we never gain time by being placed backwards. */
u64_u32_store(cfs_rq->min_vruntime,
- max_vruntime(cfs_rq->min_vruntime, vruntime));
+ max_t(u64, cfs_rq->min_vruntime, vruntime));
}
static inline bool __entity_less(struct rb_node *a, const struct rb_node *b)
@@ -4543,7 +4525,7 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial)
}
/* ensure we never gain time by being placed backwards. */
- se->vruntime = max_vruntime(se->vruntime, vruntime);
+ se->vruntime = max_t(u64, se->vruntime, vruntime);
}
static void check_enqueue_throttle(struct cfs_rq *cfs_rq);
--
2.25.1
next reply other threads:[~2022-10-27 1:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-27 1:53 Yajun Deng [this message]
2022-10-27 7:54 ` [PATCH] sched/fair: Remove max_vruntime() and min_vruntime() Peter Zijlstra
2022-10-27 7:55 ` Peter Zijlstra
2022-10-27 8:01 ` Yajun Deng
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=20221027015351.2511149-1-yajun.deng@linux.dev \
--to=yajun.deng@linux.dev \
--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 \
--cc=vschneid@redhat.com \
/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