From 3a90458bd84d43cc75c5a80f8c02f30d6412690a Mon Sep 17 00:00:00 2001 From: Andrew Perepechko Date: Fri, 26 Oct 2018 11:29:03 +0300 Subject: [PATCH] LU-11897 ost: improve memory allocation for ost OST_BUFSIZE is defined as 17 KiB. Lustre uses OBD_CPT_ALLOC_LARGE() to allocate buffers, which, in turn, uses kmalloc_node(). kmalloc_node(8192+) falls back to the traditional buddy allocator kmalloc_large_node(). In the end, 32 KiB is allocated using a 17 KiB allocation request. This patch changes OST_BUFSIZE to 32 KiB so we can effectively use the whole allocated buffer. Change-Id: I93ce5b26eff4a6a1a17b2a9bfb83161528570197 Signed-off-by: Andrew Perepechko Reviewed-by: Alexey Lyashkov Reviewed-by: Alexander Zarochentsev Tested-by: Alexander Lezhoev Cray-bug-id: LUS-6657 Reviewed-on: https://review.whamcloud.com/34127 Reviewed-by: Andreas Dilger Tested-by: Jenkins Tested-by: Maloo --- lustre/include/lustre_net.h | 2 +- lustre/ptlrpc/service.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lustre/include/lustre_net.h b/lustre/include/lustre_net.h index 7ad28ce..3e1e299 100644 --- a/lustre/include/lustre_net.h +++ b/lustre/include/lustre_net.h @@ -503,7 +503,7 @@ #define OST_NBUFS 64 /** OST_BUFSIZE = max_reqsize + max sptlrpc payload size */ -#define OST_BUFSIZE max_t(int, OST_MAXREQSIZE + 1024, 16 * 1024) +#define OST_BUFSIZE max_t(int, OST_MAXREQSIZE + 1024, 32 * 1024) /** * OST_IO_MAXREQSIZE is 18K, giving extra 46K can increase buffer utilization * rate of request buffer, please check comment of MDS_LOV_BUFSIZE for details. diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index 7092e7d..66efefd 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -781,6 +781,12 @@ ptlrpc_register_service(struct ptlrpc_service_conf *conf, service->srv_rep_portal = conf->psc_buf.bc_rep_portal; service->srv_req_portal = conf->psc_buf.bc_req_portal; + /* With slab/alloc_pages buffer size will be rounded up to 2^n */ + if (service->srv_buf_size & (service->srv_buf_size - 1)) { + int round = size_roundup_power2(service->srv_buf_size); + service->srv_buf_size = round; + } + /* Increase max reply size to next power of two */ service->srv_max_reply_size = 1; while (service->srv_max_reply_size < -- 1.8.3.1