From b7a3009065326d81e7c8afc14071e4d997dae6aa Mon Sep 17 00:00:00 2001 From: adilger <adilger> Date: Thu, 3 Jul 2008 23:22:42 +0000 Subject: [PATCH] Branch HEAD Change the LU_CACHE size from 30% of free memory to 20% of total memory, to make the cache size deterministic, and also not depend on a new kernel symbol. b=16232 i=nikita i=yury --- lustre/autoconf/lustre-core.m4 | 17 ----------------- lustre/obdclass/lu_object.c | 18 +++++++++++++----- 2 files changed, 13 insertions(+), 22 deletions(-) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 4ba3d8a7bd..9dbf3b7301 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -599,22 +599,6 @@ AC_DEFUN([LC_EXPORT___IGET], ]) ]) -# -# LC_EXPORT_NR_FREE_BUFFER_PAGES -# starting from 2.6.23 linux kernel exports nr_free_buffer_pages() -# -AC_DEFUN([LC_EXPORT_NR_FREE_BUFFER_PAGES], -[LB_CHECK_SYMBOL_EXPORT([nr_free_buffer_pages], -[mm/page_alloc.c],[ - AC_DEFINE(HAVE_EXPORT_NR_FREE_BUFFER_PAGES, 1, [kernel exports nr_free_buffer_pages]) -],[ - if test x$enable_server = xyes ; then - AC_MSG_ERROR([lustre server needs this symbol to be exported.]) - fi -]) -]) - - AC_DEFUN([LC_LUSTRE_VERSION_H], [LB_CHECK_FILE([$LINUX/include/linux/lustre_version.h],[ rm -f "$LUSTRE/include/linux/lustre_version.h" @@ -1558,7 +1542,6 @@ AC_DEFUN([LC_PROG_LINUX], LC_UNREGISTER_BLKDEV_RETURN_INT LC_KERNEL_SPLICE_READ LC_HAVE_EXPORTFS_H - LC_EXPORT_NR_FREE_BUFFER_PAGES ]) # diff --git a/lustre/obdclass/lu_object.c b/lustre/obdclass/lu_object.c index 21dad60d4e..8924d25b00 100644 --- a/lustre/obdclass/lu_object.c +++ b/lustre/obdclass/lu_object.c @@ -535,7 +535,7 @@ void lu_site_print(const struct lu_env *env, struct lu_site *s, void *cookie, EXPORT_SYMBOL(lu_site_print); enum { - LU_CACHE_PERCENT = 30, + LU_CACHE_PERCENT = 20, }; /* @@ -543,18 +543,26 @@ enum { */ static int lu_htable_order(void) { - int bits; unsigned long cache_size; + int bits; /* * Calculate hash table size, assuming that we want reasonable - * performance when 30% of available memory is occupied by cache of + * performance when 20% of total memory is occupied by cache of * lu_objects. * * Size of lu_object is (arbitrary) taken as 1K (together with inode). */ - cache_size = ll_nr_free_buffer_pages() / 100 * - LU_CACHE_PERCENT * (CFS_PAGE_SIZE / 1024); + cache_size = num_physpages; + +#if BITS_PER_LONG == 32 + /* limit hashtable size for lowmem systems to low RAM */ + if (cache_size > 1 << (30 - CFS_PAGE_SHIFT)) + cache_size = 1 << (30 - CFS_PAGE_SHIFT) * 3 / 4; +#endif + + cache_size = cache_size / 100 * LU_CACHE_PERCENT * + (CFS_PAGE_SIZE / 1024); for (bits = 1; (1 << bits) < cache_size; ++bits) { ; -- GitLab