Peter Zijlstra writes: > On Thu, Apr 12, 2018 at 12:55:39PM -0700, Francisco Jerez wrote: >> Actually assuming that a single geometric feature of the power curve is >> known -- it being convex in the frequency range allowed by the policy >> (which is almost always the case, not only for Intel CPUs), the optimal >> frequency for an IO-bound workload is fully independent of the exact >> power curve -- It's just the minimum CPU frequency that's able to keep >> the bottlenecking IO device at 100% utilization. > > I think that is difficult to determine with the information at hand. We > have lost all device information by the time we reach the scheduler. I assume you mean it's difficult to tell whether the workload is CPU-bound or IO-bound? Yeah, it's non-trivial to determine whether the system is bottlenecking on IO, it requires additional infrastructure to keep track of IO utilization (that's the purpose of PATCH 1), and even then it involves some heuristic assumptions which are not guaranteed fail-proof, so the controller needs to be prepared for things to behave reasonably when the assumptions deviate from reality (see the comments in PATCH 6 for more details on what happens in such cases) -- How frequently that happens in practice is what determines how far the controller's response will be from the optimally energy-efficient behavior in a real workload. It seems to work fairly well in practice, at least in the sample of test-cases I've been able to gather data from so far. Anyway that's the difficult part. Once (if) you know you're IO-bound, determining the optimal (most energy-efficient) CPU frequency is relatively straightforward, and doesn't require knowledge of the exact power curve of the CPU (beyond clamping the controller response to the convexity region of the power curve).