About CPU cores numbering an processor affinity

Ivan Voras ivoras at freebsd.org
Mon Aug 26 11:45:07 UTC 2013


On 23/08/2013 15:23, Dmitry Sivachenko wrote:
> Hello!
> 
> I am using FreeBSD-9-STABLE on the following hardware:
> 
> FreeBSD/SMP: Multiprocessor System Detected: 24 CPUs
> FreeBSD/SMP: 2 package(s) x 6 core(s) x 2 SMT threads
> 
> So I have 2 physical CPUs with 6 core each.
> 
> # cpuset -g
> pid -1 mask: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23
> 
> 
> So each of 24 cores are numbered 0..23.
> 
> 1) In what particular order are these cores numbered?  Can I assume that 0..11 correspond to 1st physical CPU and 12..23 to second?  How SMT threads are numbered within each core?

You could look at the kern.sched.topology_spec sysctl, which outputs
like this:

<groups>
 <group level="1" cache-level="0">
  <cpu count="8" mask="ff">0, 1, 2, 3, 4, 5, 6, 7</cpu>
  <children>
   <group level="2" cache-level="2">
    <cpu count="4" mask="f">0, 1, 2, 3</cpu>
   </group>
   <group level="2" cache-level="2">
    <cpu count="4" mask="f0">4, 5, 6, 7</cpu>
   </group>
  </children>
 </group>
</groups>

Note that this output is created from the kernel's own interpretation of
the pysical CPUs, not necessarily from what the physical topology
actually is (but if there is a mismatch, it's a bug).


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20130826/e209f0a3/attachment.sig>


More information about the freebsd-hackers mailing list