diff options
| author | Balbir Singh <balbir@linux.vnet.ibm.com> | 2008-02-22 02:55:53 -0500 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2008-02-25 10:34:17 -0500 |
| commit | 70eee74b70c1a8485ec5f2bafa13dbc66fab6e02 (patch) | |
| tree | 837c9a55d3c21221b8f7b29a468fb6d366f3dc4c /kernel | |
| parent | 6892b75e60557a48c01d57ba320419a9e2ce9846 (diff) | |
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')
| -rw-r--r-- | kernel/sched_fair.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c index 6c091d6e15..7abad50d93 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) | |||
| 202 | 202 | ||
| 203 | static inline struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq) | 203 | static inline struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq) |
| 204 | { | 204 | { |
| 205 | struct rb_node **link = &cfs_rq->tasks_timeline.rb_node; | 205 | struct rb_node *last; |
| 206 | struct sched_entity *se = NULL; | 206 | struct sched_entity *se; |
| 207 | struct rb_node *parent; | ||
| 208 | |||
| 209 | while (*link) { | ||
| 210 | parent = *link; | ||
| 211 | se = rb_entry(parent, struct sched_entity, run_node); | ||
| 212 | link = &parent->rb_right; | ||
| 213 | } | ||
| 214 | 207 | ||
| 208 | last = rb_last(&cfs_rq->tasks_timeline); | ||
| 209 | if (!last) | ||
| 210 | return NULL; | ||
| 211 | se = rb_entry(last, struct sched_entity, run_node); | ||
| 215 | return se; | 212 | return se; |
| 216 | } | 213 | } |
| 217 | 214 | ||
