net/rds: Use DMA memory pool allocation for rds_header
Currently, RDS calls ib_dma_alloc_coherent() to allocate a large piece of contiguous DMA coherent memory to store struct rds_header for sending/receiving packets. The memory allocated is then partitioned into struct rds_header. This is not necessary and can be costly at times when memory is fragmented. Instead, RDS should use the DMA memory pool interface to handle this. The DMA addresses of the pre- allocated headers are stored in an array. At send/receive ring initialization and refill time, this arrary is de-referenced to get the DMA addresses. This array is not accessed at send/receive packet processing. Suggested-by: Håkon Bugge <haakon.bugge@oracle.com> Signed-off-by: Ka-Cheong Poon <ka-cheong.poon@oracle.com> Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
df1025fc27
commit
9b17f5884b
10
net/rds/ib.c
10
net/rds/ib.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006, 2018 Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2006, 2019 Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This software is available to you under a choice of one of two
|
||||
* licenses. You may choose to be licensed under the terms of the GNU
|
||||
@@ -107,6 +107,8 @@ static void rds_ib_dev_free(struct work_struct *work)
|
||||
rds_ib_destroy_mr_pool(rds_ibdev->mr_1m_pool);
|
||||
if (rds_ibdev->pd)
|
||||
ib_dealloc_pd(rds_ibdev->pd);
|
||||
if (rds_ibdev->rid_hdrs_pool)
|
||||
dma_pool_destroy(rds_ibdev->rid_hdrs_pool);
|
||||
|
||||
list_for_each_entry_safe(i_ipaddr, i_next, &rds_ibdev->ipaddr_list, list) {
|
||||
list_del(&i_ipaddr->list);
|
||||
@@ -179,6 +181,12 @@ static void rds_ib_add_one(struct ib_device *device)
|
||||
rds_ibdev->pd = NULL;
|
||||
goto put_dev;
|
||||
}
|
||||
rds_ibdev->rid_hdrs_pool = dma_pool_create(device->name,
|
||||
device->dma_device,
|
||||
sizeof(struct rds_header),
|
||||
L1_CACHE_BYTES, 0);
|
||||
if (!rds_ibdev->rid_hdrs_pool)
|
||||
goto put_dev;
|
||||
|
||||
rds_ibdev->mr_1m_pool =
|
||||
rds_ib_create_mr_pool(rds_ibdev, RDS_IB_MR_1M_POOL);
|
||||
|
Reference in New Issue
Block a user