On 6/27/05, Tetsuo Handa <from-kernelnewbies@xxxxxxxxxxxxxxxxxxx> wrote: > > > I am writing a kernel module, and I want to get the number of CPU. If > > > the machine is UP, the value returned will be 1, but if the machine is > > > SMP, the value returned will be the number of CPU available. > > > > I think NR_CPUS give the number of the cpu in the system. You can use it > > NR_CPUS is the max number that kernel supports. > I think num_online_cpus() is what you want. > http://lxr.linux.no/source/include/linux/cpumask.h#L349 Looks like num_online_cpus() is not exported, so it is impossible to use it from a module, isnt it? Thanks, Hieu -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/