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>
This commit is contained in:
parent
ad474caca3
commit
2002c69595
|
@ -716,6 +716,15 @@ enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int wakeup)
|
||||||
__enqueue_entity(cfs_rq, se);
|
__enqueue_entity(cfs_rq, se);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void clear_buddies(struct cfs_rq *cfs_rq, struct sched_entity *se)
|
||||||
|
{
|
||||||
|
if (cfs_rq->last == se)
|
||||||
|
cfs_rq->last = NULL;
|
||||||
|
|
||||||
|
if (cfs_rq->next == se)
|
||||||
|
cfs_rq->next = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int sleep)
|
dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int sleep)
|
||||||
{
|
{
|
||||||
|
@ -738,11 +747,7 @@ dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int sleep)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cfs_rq->last == se)
|
clear_buddies(cfs_rq, se);
|
||||||
cfs_rq->last = NULL;
|
|
||||||
|
|
||||||
if (cfs_rq->next == se)
|
|
||||||
cfs_rq->next = NULL;
|
|
||||||
|
|
||||||
if (se != cfs_rq->curr)
|
if (se != cfs_rq->curr)
|
||||||
__dequeue_entity(cfs_rq, se);
|
__dequeue_entity(cfs_rq, se);
|
||||||
|
@ -977,6 +982,8 @@ static void yield_task_fair(struct rq *rq)
|
||||||
if (unlikely(cfs_rq->nr_running == 1))
|
if (unlikely(cfs_rq->nr_running == 1))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
clear_buddies(cfs_rq, se);
|
||||||
|
|
||||||
if (likely(!sysctl_sched_compat_yield) && curr->policy != SCHED_BATCH) {
|
if (likely(!sysctl_sched_compat_yield) && curr->policy != SCHED_BATCH) {
|
||||||
update_rq_clock(rq);
|
update_rq_clock(rq);
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue