From d7e95bf4ed7e6901465bdfb77ad2e776b4a77fd9 Mon Sep 17 00:00:00 2001 From: Wei Lin Guay Date: Mon, 26 Jun 2017 21:41:52 -0600 Subject: [PATCH] net/rds: Reduce memory footprint in rds_sendmsg MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Orabug: 26151323 8K + 256 (8448B) is an important message size for the RDBMS workload. Since Infiniband supports scatter-gather in hardware, there is no reason to fragment each RDS message into PAGE_SIZE work requests. Hence, RDS fragment sizes up to 16K has been introduced. Fixes: 23f90cccfba4 ("RDS: fix the sg allocation based on actual msg sz") Previous behavior was allocating a contiguous memory buffer, corresponding to the size of the RDS message. Although this was functional correct, it introduced hard pressure on the memory allocation system, which was not needed. This commit fixes the drawback introduced by only allocating the buffer according to RDS_MAX_FRAG_SIZE. Orabug: 26350949 Signed-off-by: Wei Lin Guay Signed-off-by: HÃ¥kon Bugge Acked-by: Joe Jin Reviewed-by: Yuval Shaia Tested-by: John Sobecki --- net/rds/page.c | 4 ++-- net/rds/rds.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/net/rds/page.c b/net/rds/page.c index 59cd71cbb991f..e874b32bc952f 100644 --- a/net/rds/page.c +++ b/net/rds/page.c @@ -129,8 +129,8 @@ int rds_page_remainder_alloc(struct scatterlist *scat, unsigned long bytes, /* jump straight to allocation if we're trying for a huge page */ if (bytes >= PAGE_SIZE) { if (large_page) { - order = get_order(bytes); - size = bytes; + size = min_t(unsigned int, bytes, RDS_MAX_FRAG_SIZE); + order = get_order(size); } else { order = 0; size = PAGE_SIZE; diff --git a/net/rds/rds.h b/net/rds/rds.h index 61c78639958c1..264f8b43b4658 100644 --- a/net/rds/rds.h +++ b/net/rds/rds.h @@ -9,6 +9,7 @@ #include #include #include +#include #include "info.h" -- 2.50.1