Re: [RFC PATCH v1 00/11] Create fast idle path for short idle periods

From: Peter Zijlstra
Date: Wed Jul 12 2017 - 04:34:32 EST

On Wed, Jul 12, 2017 at 12:15:08PM +0800, Li, Aubrey wrote:
> Okay, the difference is that Mike's patch uses a very simple algorithm to make the decision.

No, the difference is that we don't end up with duplication of a metric
ton of code.

It uses the normal idle path, it just makes the NOHZ enter fail.

The condition Mike uses is why that patch never really went anywhere and
needs work.

For the condition I tend to prefer something auto-adjusting vs a tunable
threshold that everybody + dog needs to manually adjust.

So add something that measures the cost of tick_nohz_idle_{enter,exit}()
and base the threshold off of that. Then of course, there's the question
which of the idle estimates to use.

The cpuidle idle estimate includes IRQs, which is important for actual
idle states, but not all interrupts re-enable the tick.

The scheduler idle estimate only considers task activity, which tends to
re-enable the tick.

So the cpuidle estimate is pessimistic in that it'll vastly under
estimate the actual nohz period, while the scheduler estimate will over
estimate. I suspsect the scheduler one is closer to the actual nohz
duration, but this is something we'll have to play with.