*/
/* XXX Liang: num_physpages... fix me */
#define num_physpages (64 * 1024)
+#define CFS_NUM_CACHEPAGES num_physpages
#define CFS_DECL_MMSPACE
#define CFS_MMSPACE_OPEN do {} while(0)
#define libcfs_memory_pressure_set() do { current->flags |= PF_MEMALLOC; } while (0)
#define libcfs_memory_pressure_clr() do { current->flags &= ~PF_MEMALLOC; } while (0)
+#if BITS_PER_LONG == 32
+/* limit to lowmem on 32-bit systems */
+#define CFS_NUM_CACHEPAGES min(num_physpages, 1UL << (30-CFS_PAGE_SHIFT) *3/4)
+#else
+#define CFS_NUM_CACHEPAGES num_physpages
+#endif
+
/*
* In Linux there is no way to determine whether current execution context is
* blockable.
)
#define num_physpages (64 * 1024)
+#define CFS_NUM_CACHEPAGES num_physpages
#else
/* memory */
/* memory size: used for some client tunables */
-#define num_physpages (256 * 1024) /* 1GB */
+#define num_physpages (256 * 1024) /* 1GB */
+#define CFS_NUM_CACHEPAGES num_physpages
/* VFS stuff */
/*
* 50 ldlm locks for 1MB of RAM.
*/
-#define LDLM_POOL_HOST_L ((num_physpages >> (20 - CFS_PAGE_SHIFT)) * 50)
+#define LDLM_POOL_HOST_L ((CFS_NUM_CACHEPAGES >> (20 - CFS_PAGE_SHIFT)) * 50)
/*
* Maximal possible grant step plan in %.
oss_max_threads = oss_min_threads = oss_num_threads;
} else {
/* Base min threads on memory and cpus */
- oss_min_threads = num_possible_cpus() * num_physpages >>
+ oss_min_threads = num_possible_cpus() * CFS_NUM_CACHEPAGES >>
(27 - CFS_PAGE_SHIFT);
if (oss_min_threads < OSS_THREADS_MIN)
oss_min_threads = OSS_THREADS_MIN;