Skip to contentSkip to conversation

kernel/sched_fair.c: task_new_fair() have call update_curr() twice

PATCH In review figo.zhang 2 participants 2 messages Apr 8, 2009

lore
Share & tools
lore

figo.zhang

author
#0 lore raw

PATCH 1/1 kernel/sched_fair.c: task_new_fair() have call update_curr() twice

The task_new_fair() will call update_curr() twice, one is in task_new_fair(), and other one in enqueue_task_fair()->enqueue_entity(), they do the same, so it should be need one time.

kernel/sched_fair.c +0 -0
index 3816f21..d5913bb 100644
@@ -1713,7 +1713,7 @@ static void task_new_fair(struct rq *rq, struct

task_struct *p)
sched_info_queued(p);

- update_curr(cfs_rq);
+
place_entity(cfs_rq, se, 1);

/* 'curr' will be NULL if the child belongs to a different
group */

#1 lore raw
Quoted 21 lines · figo.zhang

The task_new_fair() will call update_curr() twice, one is in task_new_fair(), and other one in enqueue_task_fair()->enqueue_entity(), they do the same, so it should be need one time.

kernel/sched_fair.c +1 -1
index 3816f21..d5913bb 100644
@@ -1713,7 +1713,7 @@ static void task_new_fair(struct rq *rq, struct
 task_struct *p) 
 	sched_info_queued(p);
 
-	update_curr(cfs_rq);
+
 	place_entity(cfs_rq, se, 1);
 
 	/* 'curr' will be NULL if the child belongs to a different
Quoted 1 line

group */

Except that update_curr() changes ->vruntime, and place_entity() uses ->vruntime. Therefore the above is not a NOP.