Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 69079
b: refs/heads/master
c: 2b1e315
h: refs/heads/master
i:
  69077: e2fece0
  69075: 0423706
  69071: 205de0d
v: v3
  • Loading branch information
Dmitry Adamushko authored and Ingo Molnar committed Oct 15, 2007
1 parent 19bfbf4 commit 683cb9e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8651a86c342ab79a956afec0c5971acaad38d3a1
refs/heads/master: 2b1e315dd2822c99793485f9e53a73459fb399c1
25 changes: 5 additions & 20 deletions trunk/kernel/sched_fair.c
Original file line number Diff line number Diff line change
Expand Up @@ -739,9 +739,7 @@ static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int sleep)
static void yield_task_fair(struct rq *rq)
{
struct cfs_rq *cfs_rq = task_cfs_rq(rq->curr);
struct rb_node **link = &cfs_rq->tasks_timeline.rb_node;
struct sched_entity *rightmost, *se = &rq->curr->se;
struct rb_node *parent;

/*
* Are we the only task in the tree?
Expand All @@ -755,39 +753,26 @@ static void yield_task_fair(struct rq *rq)
* Dequeue and enqueue the task to update its
* position within the tree:
*/
dequeue_entity(cfs_rq, se, 0);
enqueue_entity(cfs_rq, se, 0);
update_curr(cfs_rq);

return;
}
/*
* Find the rightmost entry in the rbtree:
*/
do {
parent = *link;
link = &parent->rb_right;
} while (*link);

rightmost = rb_entry(parent, struct sched_entity, run_node);
rightmost = __pick_last_entity(cfs_rq);
/*
* Already in the rightmost position?
*/
if (unlikely(rightmost == se))
if (unlikely(rightmost->vruntime < se->vruntime))
return;

/*
* Minimally necessary key value to be last in the tree:
* Upon rescheduling, sched_class::put_prev_task() will place
* 'current' within the tree based on its new key value.
*/
se->vruntime = rightmost->vruntime + 1;

if (cfs_rq->rb_leftmost == &se->run_node)
cfs_rq->rb_leftmost = rb_next(&se->run_node);
/*
* Relink the task to the rightmost position:
*/
rb_erase(&se->run_node, &cfs_rq->tasks_timeline);
rb_link_node(&se->run_node, parent, link);
rb_insert_color(&se->run_node, &cfs_rq->tasks_timeline);
}

/*
Expand Down

0 comments on commit 683cb9e

Please sign in to comment.