mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Josh Don <joshdon@google.com>
Cc: Tejun Heo <tj@kernel.org>, Zefan Li <lizefan.x@bytedance.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Ingo Molnar <mingo@redhat.com>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Daniel Bristot de Oliveira <bristot@redhat.com>,
	cgroups@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] cgroup: add cpu.stat_percpu
Date: Tue, 11 Jan 2022 13:49:59 +0100	[thread overview]
Message-ID: <Yd189wHB2LJcK1Pv@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20220107234138.1765668-1-joshdon@google.com>

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.

  parent reply	other threads:[~2022-01-11 12:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-07 23:41 Josh Don
2022-01-07 23:41 ` [PATCH 2/2] sched: show percpu throttled stats Josh Don
2022-01-11 12:49 ` Peter Zijlstra [this message]
2022-01-11 23:38   ` [PATCH 1/2] cgroup: add cpu.stat_percpu Josh Don
2022-01-12  8:30     ` Peter Zijlstra
2022-01-12 20:23     ` Tejun Heo
2022-01-13  1:55       ` Josh Don

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yd189wHB2LJcK1Pv@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=cgroups@vger.kernel.org \
    --cc=dietmar.eggemann@arm.com \
    --cc=hannes@cmpxchg.org \
    --cc=joshdon@google.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan.x@bytedance.com \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=tj@kernel.org \
    --cc=vincent.guittot@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome