Re: [PATCH 2/4] numa: append per-node execution info in memory.numa_stat

From: Peter Zijlstra
Date: Thu Jul 11 2019 - 09:45:44 EST


On Wed, Jul 03, 2019 at 11:29:15AM +0800, çè wrote:

> +++ b/include/linux/memcontrol.h
> @@ -190,6 +190,7 @@ enum memcg_numa_locality_interval {
>
> struct memcg_stat_numa {
> u64 locality[NR_NL_INTERVAL];
> + u64 exectime;

Maybe call the field jiffies, because that's what it counts.

> };
>
> #endif
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 2edf3f5ac4b9..d5f48365770f 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -3575,6 +3575,18 @@ static int memcg_numa_stat_show(struct seq_file *m, void *v)
> seq_printf(m, " %u", jiffies_to_msecs(sum));
> }
> seq_putc(m, '\n');
> +
> + seq_puts(m, "exectime");
> + for_each_online_node(nr) {
> + int cpu;
> + u64 sum = 0;
> +
> + for_each_cpu(cpu, cpumask_of_node(nr))
> + sum += per_cpu(memcg->stat_numa->exectime, cpu);
> +
> + seq_printf(m, " %llu", jiffies_to_msecs(sum));
> + }
> + seq_putc(m, '\n');
> #endif
>
> return 0;