From: Wei Lin Guay Date: Tue, 27 Jun 2017 03:41:52 +0000 (-0600) Subject: net/rds: Reduce memory footprint in rds_sendmsg X-Git-Tag: v4.1.12-105.0.20170705_2000~8 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=d7e95bf4ed7e;p=users%2Fjedix%2Flinux-maple.git net/rds: Reduce memory footprint in rds_sendmsg 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 --- 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"