[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yd189wHB2LJcK1Pv@hirez.programming.kicks-ass.net>
Date: Tue, 11 Jan 2022 13:49:59 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Josh Don <joshdon@...gle.com>
Cc: Tejun Heo <tj@...nel.org>, Zefan Li <lizefan.x@...edance.com>,
Johannes Weiner <hannes@...xchg.org>,
Ingo Molnar <mingo@...hat.com>,
Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>,
Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
cgroups@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] cgroup: add cpu.stat_percpu
On Fri, Jan 07, 2022 at 03:41:37PM -0800, Josh Don wrote:
> + seq_puts(seq, "usage_usec");
> + for_each_possible_cpu(cpu) {
> + cached_bstat = per_cpu_ptr(&cached_percpu_stats, cpu);
> + val = cached_bstat->cputime.sum_exec_runtime;
> + do_div(val, NSEC_PER_USEC);
> + seq_printf(seq, " %llu", val);
> + }
> + seq_puts(seq, "\n");
> +
> + seq_puts(seq, "user_usec");
> + for_each_possible_cpu(cpu) {
> + cached_bstat = per_cpu_ptr(&cached_percpu_stats, cpu);
> + val = cached_bstat->cputime.utime;
> + do_div(val, NSEC_PER_USEC);
> + seq_printf(seq, " %llu", val);
> + }
> + seq_puts(seq, "\n");
> +
> + seq_puts(seq, "system_usec");
> + for_each_possible_cpu(cpu) {
> + cached_bstat = per_cpu_ptr(&cached_percpu_stats, cpu);
> + val = cached_bstat->cputime.stime;
> + do_div(val, NSEC_PER_USEC);
> + seq_printf(seq, " %llu", val);
> + }
> + seq_puts(seq, "\n");
This is an anti-pattern; given enough CPUs (easy) this will trivially
overflow the 1 page seq buffer.
People are already struggling to fix existing ABI, lets not make the
problem worse.
Powered by blists - more mailing lists