public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched/eevdf: add helper function entity_deadline_is_valid
@ 2024-01-03  2:32 Liu Song
  0 siblings, 0 replies; only message in thread
From: Liu Song @ 2024-01-03  2:32 UTC (permalink / raw)
  To: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
	rostedt, bsegall, mgorman, bristot, vschneid
  Cc: linux-kernel, liusong

Add the helper function "entity_deadline_is_valid", then
corresponding code logic can be inferred from the function
name, improving readability of the code.

Signed-off-by: Liu Song <liusong@linux.alibaba.com>
---
 kernel/sched/fair.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 533547e3c90a..83ddff74eb91 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -563,6 +563,11 @@ static inline s64 entity_key(struct cfs_rq *cfs_rq, struct sched_entity *se)
 	return (s64)(se->vruntime - cfs_rq->min_vruntime);
 }
 
+static inline bool entity_deadline_is_valid(struct sched_entity *se)
+{
+	return (s64)(se->vruntime - se->deadline) < 0;
+}
+
 #define __node_2_se(node) \
 	rb_entry((node), struct sched_entity, run_node)
 
@@ -977,7 +982,7 @@ static void clear_buddies(struct cfs_rq *cfs_rq, struct sched_entity *se);
  */
 static void update_deadline(struct cfs_rq *cfs_rq, struct sched_entity *se)
 {
-	if ((s64)(se->vruntime - se->deadline) < 0)
+	if (entity_deadline_is_valid(se))
 		return;
 
 	/*
-- 
2.19.1.6.gb485710b


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-03  2:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-03  2:32 [PATCH] sched/eevdf: add helper function entity_deadline_is_valid Liu Song

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox