Messages in this thread | | | Date | Fri, 6 Dec 2019 13:01:31 +0100 | From | Peter Zijlstra <> | Subject | Re: [PATCH] psi: Only collect online cpu time in collect_percpu_times |
| |
On Fri, Dec 06, 2019 at 12:29:28PM +0800, liu.song11@zte.com.cn wrote:
> >No, the value will not change, but it need not be 0. > > Hi, > > Suppose there are 4 cpu online, then we take cpu 3 offline. In "collect_percpu_times", > because "for_each_possible_cpu", will still collect the time of cpu 3 which is offline.
Correct, someone needs to collect the last deltas.
> However, it is clear that "nonidle" will remain at 0 until cpu 3 comes online again.
How does it become 0?
Consider
CPU2 CPU3
// runs crap, nonidle increases
// offline CPU3
// goes offline, nonidle is still >0
At this point someone needs to collect the delta from CPU3 to make it 0. But if you only iterate online CPUs, that will not happen.
> And the value of "deltas[s]" will not change after collecting CPU 2. In "get_recent_times", > the value of "groupc->times_prev[aggregator][s]" corresponding to cpu 3 will not change.
They will not change after the first collection after hot-un-plug. You need at least one collection after it stops running crap.
> This is only a case where one CPU goes offline. If there are multiple CPUs offline, > it will correspond to more meaningless operations. So here should be changed to > "for_each_online_cpu", the effect is exactly the same as "for_each_possible_cpu", > and the possible meaningless processes are excluded.
It is not. Or if it is, you failed to explain who collects on hotplug.
| |