diff --git a/lustre/include/liblustre.h b/lustre/include/liblustre.h index 76f2d24bd377eb2bcede8805dd9093172b908bd3..2e4968fdc2cac707a11d5e3b2de6945c185f6fd4 100644 --- a/lustre/include/liblustre.h +++ b/lustre/include/liblustre.h @@ -96,8 +96,11 @@ typedef unsigned short umode_t; #ifndef smp_processor_id #define smp_processor_id() 0 #endif -#ifndef smp_num_cpus -#define smp_num_cpus 1 +#ifndef num_online_cpus +#define num_online_cpus() 1 +#endif +#ifndef num_possible_cpus +#define num_possible_cpus() 1 #endif /* always adopt 2.5 definitions */ diff --git a/lustre/include/lustre_dlm.h b/lustre/include/lustre_dlm.h index 49dcd79bb8125666d51ae35437710692de027d40..873a6a11c4012c3916521bd4ab271558f0ff8277 100644 --- a/lustre/include/lustre_dlm.h +++ b/lustre/include/lustre_dlm.h @@ -27,7 +27,7 @@ struct obd_device; #define OBD_LDLM_DEVICENAME "ldlm" -#define LDLM_DEFAULT_LRU_SIZE (100 * smp_num_cpus) +#define LDLM_DEFAULT_LRU_SIZE (100 * num_online_cpus()) #define LDLM_DEFAULT_MAX_ALIVE (cfs_time_seconds(36000)) typedef enum { diff --git a/lustre/include/lustre_net.h b/lustre/include/lustre_net.h index 9d1cf2081ea072a987b0ab7634234038570fedc6..a7ed10a3527659b502bceabd91c56b4cc2e0738e 100644 --- a/lustre/include/lustre_net.h +++ b/lustre/include/lustre_net.h @@ -87,10 +87,11 @@ * considered full when less than ?_MAXREQSIZE is left in them. */ -#define LDLM_THREADS_AUTO_MIN min((int)(smp_num_cpus * smp_num_cpus * 2), 8) +#define LDLM_THREADS_AUTO_MIN \ + min((int)(num_online_cpus() * num_online_cpus() * 2), 8) #define LDLM_THREADS_AUTO_MAX (LDLM_THREADS_AUTO_MIN * 16) #define LDLM_BL_THREADS LDLM_THREADS_AUTO_MIN -#define LDLM_NBUFS (64 * smp_num_cpus) +#define LDLM_NBUFS (64 * num_online_cpus()) #define LDLM_BUFSIZE (8 * 1024) #define LDLM_MAXREQSIZE (5 * 1024) #define LDLM_MAXREPSIZE (1024) @@ -108,7 +109,7 @@ #define MDS_THREADS_MIN 2 #define MDS_THREADS_MAX 512 #define MDS_THREADS_MIN_READPAGE 2 -#define MDS_NBUFS (64 * smp_num_cpus) +#define MDS_NBUFS (64 * num_online_cpus()) #define MDS_BUFSIZE (8 * 1024) /* Assume file name length = FNAME_MAX = 256 (true for ext3). * path name length = PATH_MAX = 4096 @@ -145,7 +146,7 @@ #define MGS_THREADS_AUTO_MIN 2 #define MGS_THREADS_AUTO_MAX 32 -#define MGS_NBUFS (64 * smp_num_cpus) +#define MGS_NBUFS (64 * num_online_cpus()) #define MGS_BUFSIZE (8 * 1024) #define MGS_MAXREQSIZE (7 * 1024) #define MGS_MAXREPSIZE (9 * 1024) @@ -153,7 +154,7 @@ /* Absolute limits */ #define OSS_THREADS_MIN 2 #define OSS_THREADS_MAX 512 -#define OST_NBUFS (64 * smp_num_cpus) +#define OST_NBUFS (64 * num_online_cpus()) #define OST_BUFSIZE (8 * 1024) /* OST_MAXREQSIZE ~= 4768 bytes = * lustre_msg + obdo + 16 * obd_ioobj + 256 * niobuf_remote