From cbd821e664b7c800fcc99812ea5f97dc3af2184d Mon Sep 17 00:00:00 2001 From: johann Date: Thu, 24 Sep 2009 15:11:32 +0000 Subject: [PATCH] Branch HEAD b=18505 i=adilger i=panda limit to low memory on 32-bit system. --- libcfs/include/libcfs/darwin/darwin-mem.h | 1 + libcfs/include/libcfs/linux/linux-mem.h | 7 +++++++ libcfs/include/libcfs/winnt/portals_utils.h | 1 + lustre/include/liblustre.h | 3 ++- lustre/ldlm/ldlm_pool.c | 2 +- lustre/ost/ost_handler.c | 2 +- 6 files changed, 13 insertions(+), 3 deletions(-) diff --git a/libcfs/include/libcfs/darwin/darwin-mem.h b/libcfs/include/libcfs/darwin/darwin-mem.h index 95bfa06..c7dd0a0 100644 --- a/libcfs/include/libcfs/darwin/darwin-mem.h +++ b/libcfs/include/libcfs/darwin/darwin-mem.h @@ -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) diff --git a/libcfs/include/libcfs/linux/linux-mem.h b/libcfs/include/libcfs/linux/linux-mem.h index 8fb2184..8f5a925 100644 --- a/libcfs/include/libcfs/linux/linux-mem.h +++ b/libcfs/include/libcfs/linux/linux-mem.h @@ -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. diff --git a/libcfs/include/libcfs/winnt/portals_utils.h b/libcfs/include/libcfs/winnt/portals_utils.h index 54bb4ee..cb60fe2 100644 --- a/libcfs/include/libcfs/winnt/portals_utils.h +++ b/libcfs/include/libcfs/winnt/portals_utils.h @@ -297,6 +297,7 @@ clear_user(void __user *to, unsigned long n) ) #define num_physpages (64 * 1024) +#define CFS_NUM_CACHEPAGES num_physpages #else diff --git a/lustre/include/liblustre.h b/lustre/include/liblustre.h index 8a3332d..cb184a3 100644 --- a/lustre/include/liblustre.h +++ b/lustre/include/liblustre.h @@ -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 */ diff --git a/lustre/ldlm/ldlm_pool.c b/lustre/ldlm/ldlm_pool.c index 3542a55..9560f34 100644 --- a/lustre/ldlm/ldlm_pool.c +++ b/lustre/ldlm/ldlm_pool.c @@ -114,7 +114,7 @@ /* * 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 %. diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c index 3f0da6c..a2fd9b9 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -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; -- 1.8.3.1