[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: NR_CPUS 's value
On Thu, 2004-11-04 at 09:20 +0800, Bao zhao wrote:
> In kernel, NR_CPU is macro and represents the number of CPUs. Many arrays
> use it to define array's size . But the number of CPUs can be known only
> when smp machine boot, so when compling the kernel , NR_CPU has no value.
> I am cofused by it .
NR_CPUS represents the maximum number of processors supported, not the
current number on a live system (that is smp_nr_cpus or something
similar). The value is known at compile-time. It is set by
CONFIG_NR_CPUS which is usually 32 if CONFIG_SMP is set.
The macro is just used to size static arrays, although such use is
falling out of favor as we now have support for many processors.
Robert Love
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/