Whamcloud - gitweb
Branch b1_8
authorjohann <johann>
Tue, 22 Sep 2009 22:43:36 +0000 (22:43 +0000)
committerjohann <johann>
Tue, 22 Sep 2009 22:43:36 +0000 (22:43 +0000)
b=18505
i=adilger
i=andrew

Limit number of locks based on low mem on 32-bit systems.

lnet/include/libcfs/darwin/darwin-mem.h
lnet/include/libcfs/linux/linux-mem.h
lnet/include/libcfs/winnt/portals_utils.h

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 8f0de46..577b1aa 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 609fba6..1e0f019 100644 (file)
@@ -172,6 +172,7 @@ static int copy_to_user(void *to, void *from, int c)
 )
 
 #define num_physpages                  (64 * 1024)
+#define CFS_NUM_CACHEPAGES             num_physpages
 
 #define snprintf  _snprintf
 #define vsnprintf _vsnprintf