sched: remove duplicate code from sched_fair.c
authorBalbir Singh <balbir@linux.vnet.ibm.com>
Fri, 22 Feb 2008 07:55:53 +0000 (13:25 +0530)
committerIngo Molnar <mingo@elte.hu>
Mon, 25 Feb 2008 15:34:17 +0000 (16:34 +0100)
pick_task_entity() duplicates existing code. This functionality can be
easily obtained using rb_last(). Avoid code duplication by using rb_last().

Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/sched_fair.c

index 6c091d6..7abad50 100644 (file)
@@ -202,16 +202,13 @@ static struct sched_entity *__pick_next_entity(struct cfs_rq *cfs_rq)
 
 static inline struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq)
 {
-       struct rb_node **link = &cfs_rq->tasks_timeline.rb_node;
-       struct sched_entity *se = NULL;
-       struct rb_node *parent;
-
-       while (*link) {
-               parent = *link;
-               se = rb_entry(parent, struct sched_entity, run_node);
-               link = &parent->rb_right;
-       }
+       struct rb_node *last;
+       struct sched_entity *se;
 
+       last = rb_last(&cfs_rq->tasks_timeline);
+       if (!last)
+               return NULL;
+       se = rb_entry(last, struct sched_entity, run_node);
        return se;
 }