Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 70eee74b authored by Balbir Singh's avatar Balbir Singh Committed by Ingo Molnar
Browse files

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: default avatarBalbir Singh <balbir@linux.vnet.ibm.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 6892b75e
Loading
Loading
Loading
Loading
+6 −9
Original line number Original line Diff line number Diff line
@@ -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)
static inline struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq)
{
{
	struct rb_node **link = &cfs_rq->tasks_timeline.rb_node;
	struct rb_node *last;
	struct sched_entity *se = NULL;
	struct sched_entity *se;
	struct rb_node *parent;

	while (*link) {
		parent = *link;
		se = rb_entry(parent, struct sched_entity, run_node);
		link = &parent->rb_right;
	}


	last = rb_last(&cfs_rq->tasks_timeline);
	if (!last)
		return NULL;
	se = rb_entry(last, struct sched_entity, run_node);
	return se;
	return se;
}
}