summaryrefslogtreecommitdiffstats
path: root/kernel/sched_fair.c
diff options
context:
space:
mode:
authorBalbir Singh <balbir@linux.vnet.ibm.com>2008-02-22 08:55:53 +0100
committerIngo Molnar <mingo@elte.hu>2008-02-25 16:34:17 +0100
commit70eee74b70c1a8485ec5f2bafa13dbc66fab6e02 (patch)
tree837c9a55d3c21221b8f7b29a468fb6d366f3dc4c /kernel/sched_fair.c
parentsched: make early bootup sched_clock() use safer (diff)
downloadlinux-70eee74b70c1a8485ec5f2bafa13dbc66fab6e02.tar.xz
linux-70eee74b70c1a8485ec5f2bafa13dbc66fab6e02.zip
sched: remove duplicate code from sched_fair.c
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>
Diffstat (limited to 'kernel/sched_fair.c')
-rw-r--r--kernel/sched_fair.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 6c091d6e159d..7abad50d935f 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -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;
}