Re: /proc/cpuinfo format - arch dependent!

From: Willy Tarreau
Date: Sat May 07 2005 - 03:09:00 EST


Hi Andrew,

On Fri, May 06, 2005 at 09:14:55PM -0700, Andrew Morton wrote:
> Ricky Beam <jfbeam@xxxxxxxxxxxxxx> wrote:
> >
> > Short of a kernel module to export the kernel variables, that's the only
> > damned way to find the number of cpus in a Linux system.
>
> Question is: do you need to know the number of CPUs (why?) or do you need
> to know the number of CPUs which you're currently allowed to use or do you
> need to know the maximum number of CPUs which you are allowed to bind
> yourself to, or what?

I personally think that what would be useful is not "the number of CPUs"
(which does not make any sense), but an enumeration of :

- the physical nodes (for NUMA)
- the physical CPUs
- each CPU's cores (for multi-core)
- each core's siblings (for HT/SMT)

each of which would report their respective id for {set,get}_affinity().
This way, the application would be able to choose how it needs to spread
over available CPUs depending on its workload. But IMHO, this should
definitely not be put in cpuinfo. I consider that cpuinfo is for the human.

> Probably these things can be worked out via the get/set_affinity() syscalls
> and/or via the cpuset sysfs interfaces, but it isn't as simple as you're
> assuming.

At least it would be simpler with some layout info like above.

Cheers,
Willy

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/