Currently, the sysctl variable hw.ncpu gives the number of logical processors. kern.sched.topology_spec gives a hard-to-parse XML description of the system topology (is this ULE-only or 4BSD as well?). Grepping /var/run/dmesg.boot will tell you the number of sockets, cores, and threads without having to parse XML. It would be preferable if these values were reflected in sysctl variables (in, take your pick, the kern.sched, hw, machdep, or dev.cpu tree) so programs don't have to parse XML or depend on being able to read dmesg.boot. Fix: Sprinkle some SYSCTL_RDINT() macros into ${ARCH}/mp_machdep.c.
OTOH, it would probably also make sense to not assume that a topology is always uniform. There could be a different number of (online) cores per package, etc. BTW, you can try to use devel/hwloc (http://www.open-mpi.org/projects/hwloc/) - it provides convenience and portability. But I agree that this is a valid PR as our kernel could do a better job at providing topological information to userland in more ready form. -- Andriy Gapon
<<On Sat, 10 Mar 2012 00:32:06 +0200, Andriy Gapon <avg@icyb.net.ua> said: > OTOH, it would probably also make sense to not assume that a topology is always > uniform. There could be a different number of (online) cores per package, etc. At a minimum, having separate "processors", "cores", and "threads" sysctl variables would ease hardware identification, and there's no need to assume that they are uniform in order to make use of this. -GAWollman
For bugs matching the following criteria: Status: In Progress Changed: (is less than) 2014-06-01 Reset to default assignee and clear in-progress tags. Mail being skipped