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 <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] cgroup: add cpu.stat_percpu
Date: Wed, 12 Jan 2022 09:30:23 +0100 [thread overview]
Message-ID: <Yd6Rn63Rha5NDd1I@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <CABk29NuGs_9uxgbv678W=BGGinZNiUHO5T57FHGbOG+HP-FT2g@mail.gmail.com>
On Tue, Jan 11, 2022 at 03:38:20PM -0800, Josh Don wrote:
> On Tue, Jan 11, 2022 at 4:50 AM Peter Zijlstra <peterz@infradead.org> wrote:
> >
> > 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.
>
> Is the concern there just the extra overhead from making multiple
> trips into this handler and re-allocating the buffer until it is large
> enough to take all the output? In that case, we could pre-allocate
> with a size of the right order of magnitude, similar to /proc/stat.
>
> Lack of per-cpu stats is a gap between cgroup v1 and v2, for which v2
> can easily support this interface given that it already tracks the
> stats percpu internally. I opted to dump them all in a single file
> here, to match the consolidation that occurred from cpuacct->cpu.stat.
Hmm.. fancy new stuff there :-) Yes, I think that would aleviate the
immediate problem. I suppose /proc/interrupts ought to get some of that
too.
Still, I'm not sure having so much data in a single file is wise. But
I've not really kept up with the discussions around this problem much.
next prev parent reply other threads:[~2022-01-12 8:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-07 23:41 [PATCH 1/2] cgroup: add cpu.stat_percpu Josh Don
2022-01-07 23:41 ` [PATCH 2/2] sched: show percpu throttled stats Josh Don
[not found] ` <20220107234138.1765668-1-joshdon-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2022-01-11 12:49 ` [PATCH 1/2] cgroup: add cpu.stat_percpu Peter Zijlstra
2022-01-11 23:38 ` Josh Don
2022-01-12 8:30 ` Peter Zijlstra [this message]
[not found] ` <CABk29NuGs_9uxgbv678W=BGGinZNiUHO5T57FHGbOG+HP-FT2g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-01-12 20:23 ` Tejun Heo
[not found] ` <Yd8429VrPCay9cn4-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
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=Yd6Rn63Rha5NDd1I@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;
as well as URLs for NNTP newsgroup(s).