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