public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Aleksandr Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
Cc: <mingo@redhat.com>, James Morse <james.morse@arm.com>,
	Gavin Shan <gshan@redhat.com>,
	"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>,
	Thomas Gleixner <tglx@linutronix.de>,
	Simon Deziel <simon.deziel@canonical.com>,
	Peter Zijlstra <peterz@infradead.org>,
	"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>,
	Valentin Schneider <vschneid@redhat.com>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] sched/cpuacct: show only present CPUs to userspace
Date: Mon, 28 Oct 2024 11:07:47 +0000	[thread overview]
Message-ID: <20241028110747.00002556@Huawei.com> (raw)
In-Reply-To: <CAEivzxdUC=R1oTdrwRDdrfdU7AUcRdTQum_cUUt__Zvi6xr+3w@mail.gmail.com>

On Fri, 25 Oct 2024 17:35:56 +0200
Aleksandr Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com> wrote:

> Gentle ping.
> 
> On Thu, Oct 17, 2024 at 12:22 PM Alexander Mikhalitsyn
> <aleksandr.mikhalitsyn@canonical.com> wrote:
> >
> > After commit b0c69e1214bc ("drivers: base: Use present CPUs in GENERIC_CPU_DEVICES")
> > changed which CPUs are shown in /sys/devices/system/cpu/ (only "present" ones)
> > it also makes sense to change cpuacct cgroupv1 code not to report CPUs
> > which are not present in the system as it confuses userspace.
> > Let's make it consistent.
> >
> > A configuration when #(present CPUs) < #(possible CPUs) is easy to get with:
> > qemu-system-x86_64
> >         -smp 3,maxcpus=12 \
> >         ...
> >

On a general basis, we definitely want these to line up, but I'm not familiar
enough with this code to give more specific review.

Other than that, I'm curious as to what userspace is tripping over this?

Jonathan
 
> > Cc: James Morse <james.morse@arm.com>
> > Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > Cc: Gavin Shan <gshan@redhat.com>
> > Cc: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Reported-by: Simon Deziel <simon.deziel@canonical.com>
> > Closes: https://github.com/canonical/lxd/issues/13324
> > Co-developed-by: Simon Deziel <simon.deziel@canonical.com>
> > Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
> > Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
> > ---
> >  kernel/sched/cpuacct.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c
> > index 0de9dda09949..0f07fbfdb20e 100644
> > --- a/kernel/sched/cpuacct.c
> > +++ b/kernel/sched/cpuacct.c
> > @@ -213,7 +213,7 @@ static int __cpuacct_percpu_seq_show(struct seq_file *m,
> >         u64 percpu;
> >         int i;
> >
> > -       for_each_possible_cpu(i) {
> > +       for_each_present_cpu(i) {
> >                 percpu = cpuacct_cpuusage_read(ca, i, index);
> >                 seq_printf(m, "%llu ", (unsigned long long) percpu);
> >         }
> > @@ -247,7 +247,7 @@ static int cpuacct_all_seq_show(struct seq_file *m, void *V)
> >                 seq_printf(m, " %s", cpuacct_stat_desc[index]);
> >         seq_puts(m, "\n");
> >
> > -       for_each_possible_cpu(cpu) {
> > +       for_each_present_cpu(cpu) {
> >                 seq_printf(m, "%d", cpu);
> >                 for (index = 0; index < CPUACCT_STAT_NSTATS; index++)
> >                         seq_printf(m, " %llu",
> > --
> > 2.34.1
> >  


  reply	other threads:[~2024-10-28 11:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-17 10:21 [PATCH] sched/cpuacct: show only present CPUs to userspace Alexander Mikhalitsyn
2024-10-25 15:35 ` Aleksandr Mikhalitsyn
2024-10-28 11:07   ` Jonathan Cameron [this message]
2024-11-08 13:00     ` Aleksandr Mikhalitsyn
2024-10-28 13:23 ` Peter Zijlstra
2024-11-08 13:17   ` Aleksandr Mikhalitsyn

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=20241028110747.00002556@Huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=aleksandr.mikhalitsyn@canonical.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=gshan@redhat.com \
    --cc=james.morse@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=rostedt@goodmis.org \
    --cc=simon.deziel@canonical.com \
    --cc=tglx@linutronix.de \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    /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