Re: [PATCH 1/1] sched/fair: improve yield_to vs fairness

Peter Zijlstra
2021-07-27T13:39:33Z

On Fri, Jul 23, 2021 at 10:35:23AM +0100, Mel Gorman wrote:
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 44c452072a1b..ddc0212d520f 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -4522,7 +4522,8 @@ pick_next_entity(struct cfs_rq *cfs_rq, struct sched_entity *curr)
> se = second;
> }
>
> - if (cfs_rq->next && wakeup_preempt_entity(cfs_rq->next, left) < 1) {
> + if (cfs_rq->next &&
> + (cfs_rq->skip == left || wakeup_preempt_entity(cfs_rq->next, left) < 1)) {
> /*
> * Someone really wants this to run. If it's not unfair, run it.
> */

With a little more context this function reads like:

se = left;

if (cfs_rq->skip && cfs_rq->skip == se) {
...
+ if (cfs_rq->next && (cfs_rq->skip == left || ...))

If '...' doesn't change @left (afaict it doesn't), then your change (+)
is equivalent to '&& true', or am I reading things wrong?