sched: release buddies on yield

Clear buddies on yield, so that the buddy rules don't schedule them
despite them being placed right-most.

This fixed a performance regression with yield-happy binary JVMs.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Tested-by: Lin Ming <ming.m.lin@intel.com>

authored by

Peter Zijlstra and committed by
Ingo Molnar
2002c695 ad474cac

+12 -5
+12 -5
kernel/sched_fair.c
··· 716 __enqueue_entity(cfs_rq, se); 717 } 718 719 static void 720 dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int sleep) 721 { ··· 747 #endif 748 } 749 750 - if (cfs_rq->last == se) 751 - cfs_rq->last = NULL; 752 - 753 - if (cfs_rq->next == se) 754 - cfs_rq->next = NULL; 755 756 if (se != cfs_rq->curr) 757 __dequeue_entity(cfs_rq, se); ··· 981 */ 982 if (unlikely(cfs_rq->nr_running == 1)) 983 return; 984 985 if (likely(!sysctl_sched_compat_yield) && curr->policy != SCHED_BATCH) { 986 update_rq_clock(rq);
··· 716 __enqueue_entity(cfs_rq, se); 717 } 718 719 + static void clear_buddies(struct cfs_rq *cfs_rq, struct sched_entity *se) 720 + { 721 + if (cfs_rq->last == se) 722 + cfs_rq->last = NULL; 723 + 724 + if (cfs_rq->next == se) 725 + cfs_rq->next = NULL; 726 + } 727 + 728 static void 729 dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int sleep) 730 { ··· 738 #endif 739 } 740 741 + clear_buddies(cfs_rq, se); 742 743 if (se != cfs_rq->curr) 744 __dequeue_entity(cfs_rq, se); ··· 976 */ 977 if (unlikely(cfs_rq->nr_running == 1)) 978 return; 979 + 980 + clear_buddies(cfs_rq, se); 981 982 if (likely(!sysctl_sched_compat_yield) && curr->policy != SCHED_BATCH) { 983 update_rq_clock(rq);