Re: [PATCH] psi: Only collect online cpu time in collect_percpu_times
From: Peter Zijlstra
Date: Wed Dec 04 2019 - 07:35:12 EST
On Mon, Dec 02, 2019 at 09:09:28PM +0800, Liu Song wrote:
> From: Liu Song <liu.song11@xxxxxxxxxx>
>
> Tasks can only run on the online cpu, so only need to
> collect the time of the online cpu.
>
> Signed-off-by: Liu Song <liu.song11@xxxxxxxxxx>
> ---
> kernel/sched/psi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c
> index 7acc632c3b82..605f02facb7b 100644
> --- a/kernel/sched/psi.c
> +++ b/kernel/sched/psi.c
> @@ -316,7 +316,7 @@ static void collect_percpu_times(struct psi_group *group,
> * the sampling period. This eliminates artifacts from uneven
> * loading, or even entirely idle CPUs.
> */
> - for_each_possible_cpu(cpu) {
> + for_each_online_cpu(cpu) {
> u32 times[NR_PSI_STATES];
> u32 nonidle;
> u32 cpu_changed_states;
And who collects the deltas that remain after offline?