Whamcloud - gitweb
LU-6356 ptlrpc: add a 'enc_pool_max_memory_mb' module param 69/15069/4
authorSebastien Buisson <sebastien.buisson@bull.net>
Fri, 29 May 2015 12:22:55 +0000 (14:22 +0200)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 3 Aug 2015 01:57:54 +0000 (01:57 +0000)
Create a new 'enc_pool_max_memory_mb' module param for ptlrpc.
It is used to set max memory used by encoding pools, in MB.
By default encoding pools will use at max 1/8 of total physical
memory, but it appears to be too few under some circumstances.

Signed-off-by: Sebastien Buisson <sebastien.buisson@bull.net>
Change-Id: If431ba082eec4bc2c4f2131d4b6b5b7028a3a569
Reviewed-on: http://review.whamcloud.com/15069
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/ptlrpc/sec_bulk.c

index b1828b1..f6f9138 100644 (file)
 
 #include "ptlrpc_internal.h"
 
+static int mult = 20 - PAGE_CACHE_SHIFT;
+static int enc_pool_max_memory_mb;
+CFS_MODULE_PARM(enc_pool_max_memory_mb, "i", int, 0644,
+               "Encoding pool max memory (MB), 1/8 of total physical memory by default");
+
+
 /****************************************
  * bulk encryption page pools           *
  ****************************************/
@@ -741,11 +747,12 @@ int sptlrpc_enc_pool_init(void)
 {
        DEF_SHRINKER_VAR(shvar, enc_pools_shrink,
                         enc_pools_shrink_count, enc_pools_shrink_scan);
-       /*
-        * maximum capacity is 1/8 of total physical memory.
-        * is the 1/8 a good number?
-        */
+
        page_pools.epp_max_pages = totalram_pages / 8;
+       if (enc_pool_max_memory_mb > 0 &&
+           enc_pool_max_memory_mb <= (totalram_pages >> mult))
+               page_pools.epp_max_pages = enc_pool_max_memory_mb << mult;
+
        page_pools.epp_max_pools = npages_to_npools(page_pools.epp_max_pages);
 
        init_waitqueue_head(&page_pools.epp_waitq);