public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* CPU numbering & hyperthreading
@ 2006-07-18  2:05 Andrew Athan
  2006-07-18 19:03 ` Keith Mannthey
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Athan @ 2006-07-18  2:05 UTC (permalink / raw)
  To: linux-kernel


On an Intel Xeon dual CPU machine running 2.6.16 and up...

I have two highly CPU/memory/network intensive processes with 3-5 
threads each.  I am using sched_setaffinity calls to make sure these two 
processes never compete for the same physical CPU.  Am I right to assume 
that CPU #0 and #1 vs CPU #2 and #3 are separate physical CPUs on a 
2-CPU w/ hyperthreading box?

I've spent some time looking, but I did not find documentation on 
exactly how CPUs are numbered in a hyperthreaded box.

For a process with N threads where N is generally <=5, where each thread 
shares access to the same large (300Mb) data structure across several 
threads, and which pumps the data from memory to a TCP socket, making 
many futex, select, write(), send() network calls (but no disk I/O), I 
assume it is best to keep said process on the same physical CPU but 
allow use both logical processors on that CPU (vs. keeping it to a 
single logical CPU)?

Thanks,
A.




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

* Re: CPU numbering & hyperthreading
  2006-07-18  2:05 CPU numbering & hyperthreading Andrew Athan
@ 2006-07-18 19:03 ` Keith Mannthey
  0 siblings, 0 replies; 3+ messages in thread
From: Keith Mannthey @ 2006-07-18 19:03 UTC (permalink / raw)
  To: Andrew Athan; +Cc: linux-kernel

On 7/17/06, Andrew Athan <aathan_linux_kernel_1542@cloakmail.com> wrote:
>
> On an Intel Xeon dual CPU machine running 2.6.16 and up...
>
> I have two highly CPU/memory/network intensive processes with 3-5
> threads each.  I am using sched_setaffinity calls to make sure these two
> processes never compete for the same physical CPU.  Am I right to assume
> that CPU #0 and #1 vs CPU #2 and #3 are separate physical CPUs on a
> 2-CPU w/ hyperthreading box?
>
> I've spent some time looking, but I did not find documentation on
> exactly how CPUs are numbered in a hyperthreaded box.

It is up to the bios how the cpus are layed out.  Any easy way to
check for the info you want is to look at /proc/cpuinfo (you can also
get the info out of /sys/devices/system/cpu/cpu[x]/topology).  Cpus
with the same physical id are in the same package.  The info (core_id
core_siblings  physical_package_id  thread_siblings
and like kind from proc) describes the topology.

Thanks,
  Keith

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

* Re: CPU numbering & hyperthreading
@ 2006-07-18 20:46 Chuck Ebbert
  0 siblings, 0 replies; 3+ messages in thread
From: Chuck Ebbert @ 2006-07-18 20:46 UTC (permalink / raw)
  To: Andrew Athan; +Cc: linux-kernel

In-Reply-To: <44BC4200.90308@cloakmail.com>

On Mon, 17 Jul 2006 22:05:52 -0400, Andrew Athan wrote:
>
> I have two highly CPU/memory/network intensive processes with 3-5 
> threads each.  I am using sched_setaffinity calls to make sure these two 
> processes never compete for the same physical CPU.  Am I right to assume 
> that CPU #0 and #1 vs CPU #2 and #3 are separate physical CPUs on a 
> 2-CPU w/ hyperthreading box?
> 
> I've spent some time looking, but I did not find documentation on 
> exactly how CPUs are numbered in a hyperthreaded box.

There's no fixed numbering.

If you want to know the die/core/thread layout, check out
Documentation/cputopology.txt.

-- 
Chuck
And did we tell you the name of the game, boy, we call it Riding the Gravy Train.

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

end of thread, other threads:[~2006-07-18 20:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-18  2:05 CPU numbering & hyperthreading Andrew Athan
2006-07-18 19:03 ` Keith Mannthey
  -- strict thread matches above, loose matches on Subject: below --
2006-07-18 20:46 Chuck Ebbert

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