From: Santosh Shilimkar Date: Wed, 4 Nov 2015 21:42:39 +0000 (-0800) Subject: RDS: IB: scale rds_ib_allocation based on fragment size X-Git-Tag: v4.1.12-92~175^2~10 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=d99f4d2c122cb3c576f107a7cf3ab7fc229e45d0;p=users%2Fjedix%2Flinux-maple.git RDS: IB: scale rds_ib_allocation based on fragment size The 'rds_ib_sysctl_max_recv_allocation' allocation is used to manage and allocate the size of IB receive queue entry (RQE) for each IB connection. However, it relies on the hardcoded RDS_FRAG_SIZE. Lets make it scalable based on supported fragment sizes for different IB connection. Each connection can allocate different RQE size depending on the per connection fragment_size. Orabug: 21894138 Reviewed-by: Wei Lin Guay Signed-off-by: Santosh Shilimkar --- diff --git a/net/rds/ib.h b/net/rds/ib.h index 8f3c967262e7c..e377bafc477c3 100644 --- a/net/rds/ib.h +++ b/net/rds/ib.h @@ -216,6 +216,7 @@ struct rds_ib_connection { /* Protocol version specific information */ unsigned int i_flowctl:1; /* enable/disable flow ctl */ u16 i_frag_sz; /* IB fragment size */ + int8_t i_frag_pages:1; /* Batched completions */ unsigned int i_unsignaled_wrs; diff --git a/net/rds/ib_recv.c b/net/rds/ib_recv.c index f3425bf31c898..f3f634e88135e 100644 --- a/net/rds/ib_recv.c +++ b/net/rds/ib_recv.c @@ -295,8 +295,8 @@ static struct rds_page_frag *rds_ib_refill_one_frag(struct rds_ib_connection *ic return NULL; avail_allocs = atomic_add_unless(&rds_ib_allocation, - 1, rds_ib_sysctl_max_recv_allocation); - + ic->i_frag_pages, + rds_ib_sysctl_max_recv_allocation); if (!avail_allocs) { if (test_and_clear_bit(0, &rds_ib_allocation_warn)) { printk(KERN_NOTICE "RDS/IB: WARNING - " @@ -313,7 +313,7 @@ static struct rds_page_frag *rds_ib_refill_one_frag(struct rds_ib_connection *ic ic->i_frag_sz, page_mask); if (ret) { kmem_cache_free(rds_ib_frag_slab, frag); - atomic_dec(&rds_ib_allocation); + atomic_sub(ic->i_frag_pages, &rds_ib_allocation); return NULL; } rds_ib_stats_inc(s_ib_rx_total_frags);