From 78add6cb8aad0dda0528423dc930fec54ed36259 Mon Sep 17 00:00:00 2001 From: Sebastien Buisson Date: Fri, 29 May 2015 14:22:55 +0200 Subject: [PATCH] LU-6356 ptlrpc: add a 'enc_pool_max_memory_mb' module param 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 Change-Id: If431ba082eec4bc2c4f2131d4b6b5b7028a3a569 Reviewed-on: http://review.whamcloud.com/15069 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Dmitry Eremin Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- lustre/ptlrpc/sec_bulk.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lustre/ptlrpc/sec_bulk.c b/lustre/ptlrpc/sec_bulk.c index b1828b1..f6f9138 100644 --- a/lustre/ptlrpc/sec_bulk.c +++ b/lustre/ptlrpc/sec_bulk.c @@ -53,6 +53,12 @@ #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); -- 1.8.3.1