Re: [PATCH] sched: Wholesale removal of sd_idle logic
From: Vaidyanathan Srinivasan
Date: Wed Feb 16 2011 - 03:54:21 EST
* Venkatesh Pallipadi <venki@xxxxxxxxxx> [2011-02-15 10:26:01]:
<snip>
> >> @@ -3386,10 +3363,6 @@ redo:
> >> sd->balance_interval *= 2;
> >> }
> >>
> >> - if (!ld_moved && !sd_idle && sd->flags & SD_SHARE_CPUPOWER &&
> >> - !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))
> >> - ld_moved = -1;
> >
> > I have not figured out where ld_moved is checked for -1 and why we
> > need to treat this as a special case.
> >
>
> Return value of -1 was being consumed in rebalance domains() call
> to load_balance(). Returning -1 (instead of 0 in this case) makes
> rebalance_domains() to call higher domain load balancing
> with CPU_NOT_IDLE, when sibling is busy and even when there
> was no load pulled in.
Ok, so in rebalance_domain() we need not distinguish between 1 or -1
return code. We can set idle = CPU_NOT_IDLE as long as we pull
a task. With removal of sd_idle logic, the value of idle will remain
same for all domains.
Now in idle_balance() you have to check for return code > 0 in order
to reset this_rq->idle_stamp = 0. But in the next check:
if (pulled_task || time_after(jiffies, this_rq->next_balance)) {
/*
* We are going idle. next_balance may be set based on
* a busy processor. So reset next_balance.
*/
this_rq->next_balance = next_balance;
}
Earlier, we would push the next_balance interval for busy sibling case
since pulled_task will be set to -1. But now, with the removal of
sd_idle logic, the this_rq->next_balance will not be touched leading
to sooner rebalance.
In summary, the load_balance() will return 0 or 1, and the special
case of -1 is completely removed in the new code. Thanks for the
clarification.
--Vaidy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/