public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* RE: Distinguish real vs. virtual CPUs?
@ 2005-03-22  4:29 Pallipadi, Venkatesh
  2005-03-22 21:26 ` Bill Davidsen
  0 siblings, 1 reply; 10+ messages in thread
From: Pallipadi, Venkatesh @ 2005-03-22  4:29 UTC (permalink / raw)
  To: J.A. Magallon, Dan Maas; +Cc: linux-kernel

 

>This is 2xXeonHT, is, 4 cpus on 2 packages:
>
>cat /proc/cpuinfo:
>
>processor	: 0
>...
>physical id	: 0
>siblings	: 2
>core id		: 0
>cpu cores	: 1
>
>processor	: 1
>...
>physical id	: 0
>siblings	: 2
>core id		: 0
>cpu cores	: 1
>
>processor	: 2
>...
>physical id	: 3
>siblings	: 2
>core id		: 3
>cpu cores	: 1
>
>processor	: 3
>...
>physical id	: 3
>siblings	: 2
>core id		: 3
>cpu cores	: 1
>
>So something like:
>
>cat /proc/cpuinfo | grep 'core id' | uniq | wc -l
>
>would give you the number of packages or 'real cpus'. Then you have to
>choose which ones are unrelated. Usually evens are siblings of 
>odds, but
>I won't trust on it...
>

Number of unique physical id will tell you the number of physical CPU
packages in the system.
Number of unique core id will tell you the total number of CPU cores in
the system.
Number of processor will tell you the total number of logical CPUs on
the system.

Then to find out the matching pairs, 
- to pair up all HT siblings on a core: Processors that have same "core
id" are HT siblings in a core.
- to pair up all CPUs in a package: Processors that have same "physical
id" are all the CPUs belonging to the same physical package.

Thanks,
Venki

^ permalink raw reply	[flat|nested] 10+ messages in thread
* Distinguish real vs. virtual CPUs?
@ 2005-03-22  1:27 Dan Maas
  2005-03-22  1:56 ` Dave Jones
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Dan Maas @ 2005-03-22  1:27 UTC (permalink / raw)
  To: linux-kernel

Is there a canonical way for user-space software to determine how many
real CPUs are present in a system (as opposed to HyperThreaded or
otherwise virtual CPUs)?

We have an application that for performance reasons wants to run one
process per CPU. However, on a HyperThreaded system /proc/cpuinfo
lists two CPUs, and running two processes in this case is the wrong
thing to do. (Hyperthreading ends up degrading our performance,
perhaps due to cache or bus contention).

Please CC replies.

Thanks,
Dan Maas

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2005-03-23 21:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-22  4:29 Distinguish real vs. virtual CPUs? Pallipadi, Venkatesh
2005-03-22 21:26 ` Bill Davidsen
2005-03-22 21:38   ` Jan Engelhardt
2005-03-23 17:52   ` Tom Vier
2005-03-23 21:32     ` Bill Davidsen
  -- strict thread matches above, loose matches on Subject: below --
2005-03-22  1:27 Dan Maas
2005-03-22  1:56 ` Dave Jones
2005-03-22 11:55   ` Dr. David Alan Gilbert
2005-03-22  2:01 ` Daniel Andersen
2005-03-22  2:12 ` J.A. Magallon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox