From: "Brown, Len" <len.brown@intel.com>
To: Prarit Bhargava <prarit@redhat.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>
Cc: "Semin, Andrey" <andrey.semin@intel.com>
Subject: RE: [PATCH 2/2] turbostat, add set_base_cpu()
Date: Fri, 22 May 2015 15:55:15 +0000 [thread overview]
Message-ID: <1A7043D5F58CCB44A599DFD55ED4C9484688E5F2@fmsmsx115.amr.corp.intel.com> (raw)
In-Reply-To: <1432296063-22185-3-git-send-email-prarit@redhat.com>
> +void set_base_cpu(void)
> +{
> + int cpu;
> +
> + for (cpu = 0; cpu <= topo.max_cpu_num; ++cpu) {
> + if (cpu_is_not_present(cpu))
> + continue;
> + base_cpu = cpu;
> + break;
> + }
> +
> + if (base_cpu == -1)
> + err(-ENODEV, "No valid cpus found");
> +}
cpu0 hard-coding is indeed arbitrary.
However, so is this proposed replacement, base_cpu.
Either may not match where turbostat is currently running,
and thus could provoke unnecessary cross-calls to get there.
I think it would be better to ask getcpu(2) where we are already running,
and simply use that one. I think we can call it once and cache it,
as you proposed, rather than multiple system calls.
thanks,
-Len
ps. patches to turbostat should go to linux-pm@vger.kernel.org
next prev parent reply other threads:[~2015-05-22 15:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-22 12:01 [PATCH 0/2] turbostat, support CPU0 hotplug Prarit Bhargava
2015-05-22 12:01 ` [PATCH 1/2] turbostat, add base_cpu Prarit Bhargava
2015-05-22 12:01 ` [PATCH 2/2] turbostat, add set_base_cpu() Prarit Bhargava
2015-05-22 15:55 ` Brown, Len [this message]
2015-05-22 21:44 ` Prarit Bhargava
2015-05-22 22:30 ` Prarit Bhargava
2015-05-26 0:32 ` Brown, Len
2015-05-25 12:34 [PATCH 0/2] turbostat, support CPU0 hotplug [v2] Prarit Bhargava
2015-05-25 12:34 ` [PATCH 2/2] turbostat, add set_base_cpu() Prarit Bhargava
2015-05-27 21:54 ` Len Brown
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=1A7043D5F58CCB44A599DFD55ED4C9484688E5F2@fmsmsx115.amr.corp.intel.com \
--to=len.brown@intel.com \
--cc=andrey.semin@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=prarit@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.