Skip to contentSkip to conversation

sched/eevdf: add helper function entity_deadline_is_valid

PATCH New Liu Song 1 participant 1 message Jan 3, 2024 Scheduler

lore
Share & tools
lore

Liu Song

author
#0 lore raw

PATCH 1/1 sched/eevdf: add helper function entity_deadline_is_valid

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

---
 kernel/sched/fair.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
kernel/sched/fair.c +6 -1
index 533547e3c90a..83ddff74eb91 100644
@@ -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;
 
 	/*
Signature · 1 line
2.19.1.6.gb485710b