From: Robert Love <rml@tech9.net>
To: linux-kernel@vger.kernel.org
Cc: "Nakajima, Jun" <jun.nakajima@intel.com>,
chrisl@vmware.com, "Martin J. Bligh" <mbligh@aracnet.com>
Subject: [PATCH] How to get number of physical CPU in linux from user space?
Date: 25 Oct 2002 15:09:09 -0400 [thread overview]
Message-ID: <1035572950.1501.3429.camel@phantasy> (raw)
In-Reply-To: <F2DBA543B89AD51184B600508B68D4000EA170E9@fmsmsx103.fm.intel.com>
On Fri, 2002-10-25 at 14:54, Nakajima, Jun wrote:
> Recent distributions or the AC tree has additional fields in
> /proc/cpu, which tell
> - physical package id
> - number of threads
Attached patch for 2.5 adds the same fields the 2.4-ac tree have. I
consider those "standard" enough.
Is this something HT users want?
Robert Love
proc.c | 5 +++++
1 files changed, 5 insertions(+)
diff -urN linux-2.5.44/arch/i386/kernel/cpu/proc.c linux/arch/i386/kernel/cpu/proc.c
--- linux-2.5.44/arch/i386/kernel/cpu/proc.c 2002-10-19 00:02:29.000000000 -0400
+++ linux/arch/i386/kernel/cpu/proc.c 2002-10-25 15:06:23.000000000 -0400
@@ -17,6 +17,7 @@
* applications want to get the raw CPUID data, they should access
* /dev/cpu/<cpu_nr>/cpuid instead.
*/
+ extern int phys_proc_id[NR_CPUS];
static char *x86_cap_flags[] = {
/* Intel-defined */
"fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce",
@@ -74,6 +75,10 @@
/* Cache size */
if (c->x86_cache_size >= 0)
seq_printf(m, "cache size\t: %d KB\n", c->x86_cache_size);
+#ifdef CONFIG_SMP
+ seq_printf(m, "physical processor ID\t: %d\n", phys_proc_id[n]);
+ seq_printf(m, "number of siblings\t: %d\n", smp_num_siblings);
+#endif
/* We use exception 16 if we have hardware math and we've either seen it or the CPU claims it is internal */
fpu_exception = c->hard_math && (ignore_irq13 || cpu_has_fpu);
next prev parent reply other threads:[~2002-10-25 19:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-25 18:54 How to get number of physical CPU in linux from user space? Nakajima, Jun
2002-10-25 19:09 ` Robert Love [this message]
2002-10-25 19:13 ` [PATCH] " Dave Jones
2002-01-16 19:35 ` Pavel Machek
2002-10-25 19:21 ` Robert Love
2002-10-25 20:03 ` chrisl
2002-10-25 21:13 ` Alan Cox
2002-10-25 19:12 ` chrisl
-- strict thread matches above, loose matches on Subject: below --
2002-10-25 19:48 [PATCH] " Nakajima, Jun
2002-10-25 20:38 Nakajima, Jun
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=1035572950.1501.3429.camel@phantasy \
--to=rml@tech9.net \
--cc=chrisl@vmware.com \
--cc=jun.nakajima@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mbligh@aracnet.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