diff options
-rw-r--r-- | kernel/sched_fair.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c index 3e6f78c66876..ffee827fa22f 100644 --- a/kernel/sched_fair.c +++ b/kernel/sched_fair.c | |||
@@ -764,10 +764,10 @@ enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int wakeup) | |||
764 | 764 | ||
765 | static void __clear_buddies(struct cfs_rq *cfs_rq, struct sched_entity *se) | 765 | static void __clear_buddies(struct cfs_rq *cfs_rq, struct sched_entity *se) |
766 | { | 766 | { |
767 | if (cfs_rq->last == se) | 767 | if (!se || cfs_rq->last == se) |
768 | cfs_rq->last = NULL; | 768 | cfs_rq->last = NULL; |
769 | 769 | ||
770 | if (cfs_rq->next == se) | 770 | if (!se || cfs_rq->next == se) |
771 | cfs_rq->next = NULL; | 771 | cfs_rq->next = NULL; |
772 | } | 772 | } |
773 | 773 | ||
@@ -1646,8 +1646,13 @@ static struct task_struct *pick_next_task_fair(struct rq *rq) | |||
1646 | /* | 1646 | /* |
1647 | * If se was a buddy, clear it so that it will have to earn | 1647 | * If se was a buddy, clear it so that it will have to earn |
1648 | * the favour again. | 1648 | * the favour again. |
1649 | * | ||
1650 | * If se was not a buddy, clear the buddies because neither | ||
1651 | * was elegible to run, let them earn it again. | ||
1652 | * | ||
1653 | * IOW. unconditionally clear buddies. | ||
1649 | */ | 1654 | */ |
1650 | __clear_buddies(cfs_rq, se); | 1655 | __clear_buddies(cfs_rq, NULL); |
1651 | set_next_entity(cfs_rq, se); | 1656 | set_next_entity(cfs_rq, se); |
1652 | cfs_rq = group_cfs_rq(se); | 1657 | cfs_rq = group_cfs_rq(se); |
1653 | } while (cfs_rq); | 1658 | } while (cfs_rq); |