Skip to content

Commit 5660542

Browse files
Wengang-oracleMukesh Kacker
authored andcommitted
rds_rdma: allocate FMR according to max_item_soft
When max_item on the pool is very large(say 170000), large number of alloc_fmr request would fail with -EGAIN. This can greatly hurt performance. Actually, whether it is going to allocate or wait for pool flush should be according to "max_item_soft" rather than "max_item" because we are resizing the pool by changing "max_item_soft" not max_item. Also, when successfully allocated a lower layer fmr, we should increase "max_item_soft" incrementally, not set it immediately to "max_item". Orabug: 21551548 Signed-off-by: Wengang Wang <[email protected]> Reviewed-by: Chien-Hua Yen <[email protected]>
1 parent 63e56ae commit 5660542

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

net/rds/ib_rdma.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,8 @@ static struct rds_ib_mr *rds_ib_alloc_fmr(struct rds_ib_device *rds_ibdev,
341341
* We're fussy with enforcing the FMR limit, though. If the driver
342342
* tells us we can't use more than N fmrs, we shouldn't start
343343
* arguing with it */
344-
if (atomic_inc_return(&pool->item_count) <= pool->max_items)
344+
if (atomic_inc_return(&pool->item_count) <=
345+
atomic_read(&pool->max_items_soft))
345346
break;
346347

347348
atomic_dec(&pool->item_count);
@@ -431,9 +432,8 @@ static struct rds_ib_mr *rds_ib_alloc_fmr(struct rds_ib_device *rds_ibdev,
431432
else
432433
rds_ib_stats_inc(s_ib_rdma_mr_1m_alloc);
433434

434-
if (atomic_read(&pool->item_count) >
435-
atomic_read(&pool->max_items_soft))
436-
atomic_set(&pool->max_items_soft, pool->max_items);
435+
if (atomic_read(&pool->item_count) > atomic_read(&pool->max_items_soft))
436+
atomic_inc(&pool->max_items_soft);
437437

438438
return ibmr;
439439

0 commit comments

Comments
 (0)