Messages in this thread | | | Date | Wed, 3 Feb 2010 08:21:23 +0100 | From | Borislav Petkov <> | Subject | Re: nr_cpu_ids incorrect on AMD Quad-Core Opteron 8380 |
| |
On Wed, Feb 03, 2010 at 10:33:46AM +1300, zhiyi wrote: > The good thing is that I realized I should use num_present_cpus() > instead of nr_cpu_ids for my purpose (get the number of real cores > on the machine)
Just a minor thing: there could be a subtlety with hotplug when using num_present_cpus() since this includes all CPUs, even the hotplug-offlined ones. Depending on your case, you might want to use num_online_cpus() instead. Look at the comment at the beginning of <include/linux/cpumask.h> which explains all the different masks to figure out which one fits your needs best.
-- Regards/Gruss, Boris.
| |