Fix max_ncpus definition.

It was being defined as the constant 64 and at first I changed it to be
NR_CPUS instead.

However, NR_CPUS can be a large value on recent kernels (4096), and this
may cause too large kmem allocations to happen.

Therefore, now we use num_possible_cpus(), which should return a (typically)
small value which represents the maximum number of CPUs than can be brought
online in the running hardware (this value is determined at boot time by
arch-specific kernel code).

Signed-off-by: Ricardo M. Correia <ricardo.correia@oracle.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
This commit is contained in:
Ricardo M. Correia 2010-07-20 15:44:28 -07:00 committed by Brian Behlendorf
parent 81672c0122
commit 15b52c083e
1 changed files with 3 additions and 2 deletions

View File

@ -26,6 +26,7 @@
#define _SPL_SYSMACROS_H
#include <linux/module.h>
#include <linux/cpumask.h>
#include <sys/debug.h>
#include <sys/varargs.h>
#include <sys/zone.h>
@ -77,8 +78,8 @@
#define proc_pageout NULL
#define curproc get_current()
#define max_ncpus 64
#define CPU_SEQID smp_processor_id() /* I think... */
#define max_ncpus num_possible_cpus()
#define CPU_SEQID smp_processor_id()
#define _NOTE(x)
#define is_system_labeled() 0