Whamcloud - gitweb
Branch HEAD
authorjohann <johann>
Thu, 24 Sep 2009 15:11:32 +0000 (15:11 +0000)
committerjohann <johann>
Thu, 24 Sep 2009 15:11:32 +0000 (15:11 +0000)
b=18505
i=adilger
i=panda

limit to low memory on 32-bit system.

libcfs/include/libcfs/darwin/darwin-mem.h
libcfs/include/libcfs/linux/linux-mem.h
libcfs/include/libcfs/winnt/portals_utils.h
lustre/include/liblustre.h
lustre/ldlm/ldlm_pool.c
lustre/ost/ost_handler.c

index 95bfa06..c7dd0a0 100644 (file)
@@ -229,6 +229,7 @@ void cfs_mem_cache_free ( cfs_mem_cache_t *, void *);
  */
 /* 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)
index 8fb2184..8f5a925 100644 (file)
@@ -114,6 +114,13 @@ extern void __cfs_free_pages(cfs_page_t *page, unsigned int order);
 #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.
index 54bb4ee..cb60fe2 100644 (file)
@@ -297,6 +297,7 @@ clear_user(void __user *to, unsigned long n)
 )
 
 #define num_physpages                  (64 * 1024)
+#define CFS_NUM_CACHEPAGES             num_physpages
 
 #else
 
index 8a3332d..cb184a3 100644 (file)
@@ -161,7 +161,8 @@ void get_random_bytes(void *ptr, int size);
 /* 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 */
index 3542a55..9560f34 100644 (file)
 /*
  * 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 %.
index 3f0da6c..a2fd9b9 100644 (file)
@@ -2230,7 +2230,7 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
                 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;