aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAndy Grover <andy.grover@oracle.com>2010-04-23 13:49:53 -0400
committerAndy Grover <andy.grover@oracle.com>2010-09-08 21:14:06 -0400
commite4c52c98e04937ea87b0979a81354d0040d284f9 (patch)
treec7bfbd9d952ebb66e7491d7c3a1bc91db3fbfbb8 /net
parent4a81802b5e5e0b059627d7173c917711cf35e668 (diff)
RDS/IB: add _to_node() macros for numa and use {k,v}malloc_node()
Allocate send/recv rings in memory that is node-local to the HCA. This significantly helps performance. Signed-off-by: Andy Grover <andy.grover@oracle.com>
Diffstat (limited to 'net')
-rw-r--r--net/rds/ib.c2
-rw-r--r--net/rds/ib.h6
-rw-r--r--net/rds/ib_cm.c6
-rw-r--r--net/rds/ib_rdma.c5
4 files changed, 14 insertions, 5 deletions
diff --git a/net/rds/ib.c b/net/rds/ib.c
index 7a2131d37dfb..7d289d7985fe 100644
--- a/net/rds/ib.c
+++ b/net/rds/ib.c
@@ -77,7 +77,7 @@ void rds_ib_add_one(struct ib_device *device)
77 goto free_attr; 77 goto free_attr;
78 } 78 }
79 79
80 rds_ibdev = kmalloc(sizeof *rds_ibdev, GFP_KERNEL); 80 rds_ibdev = kmalloc_node(sizeof *rds_ibdev, GFP_KERNEL, ibdev_to_node(device));
81 if (!rds_ibdev) 81 if (!rds_ibdev)
82 goto free_attr; 82 goto free_attr;
83 83
diff --git a/net/rds/ib.h b/net/rds/ib.h
index c506604325d5..4bc3e2fba25a 100644
--- a/net/rds/ib.h
+++ b/net/rds/ib.h
@@ -3,6 +3,8 @@
3 3
4#include <rdma/ib_verbs.h> 4#include <rdma/ib_verbs.h>
5#include <rdma/rdma_cm.h> 5#include <rdma/rdma_cm.h>
6#include <linux/pci.h>
7#include <linux/slab.h>
6#include "rds.h" 8#include "rds.h"
7#include "rdma_transport.h" 9#include "rdma_transport.h"
8 10
@@ -167,6 +169,10 @@ struct rds_ib_device {
167 spinlock_t spinlock; /* protect the above */ 169 spinlock_t spinlock; /* protect the above */
168}; 170};
169 171
172#define pcidev_to_node(pcidev) pcibus_to_node(pcidev->bus)
173#define ibdev_to_node(ibdev) pcidev_to_node(to_pci_dev(ibdev->dma_device))
174#define rdsibdev_to_node(rdsibdev) ibdev_to_node(rdsibdev->dev)
175
170/* bits for i_ack_flags */ 176/* bits for i_ack_flags */
171#define IB_ACK_IN_FLIGHT 0 177#define IB_ACK_IN_FLIGHT 0
172#define IB_ACK_REQUESTED 1 178#define IB_ACK_REQUESTED 1
diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c
index 75eda9c82135..b5d0b60a26bc 100644
--- a/net/rds/ib_cm.c
+++ b/net/rds/ib_cm.c
@@ -347,7 +347,8 @@ static int rds_ib_setup_qp(struct rds_connection *conn)
347 goto out; 347 goto out;
348 } 348 }
349 349
350 ic->i_sends = vmalloc(ic->i_send_ring.w_nr * sizeof(struct rds_ib_send_work)); 350 ic->i_sends = vmalloc_node(ic->i_send_ring.w_nr * sizeof(struct rds_ib_send_work),
351 ibdev_to_node(dev));
351 if (!ic->i_sends) { 352 if (!ic->i_sends) {
352 ret = -ENOMEM; 353 ret = -ENOMEM;
353 rdsdebug("send allocation failed\n"); 354 rdsdebug("send allocation failed\n");
@@ -355,7 +356,8 @@ static int rds_ib_setup_qp(struct rds_connection *conn)
355 } 356 }
356 memset(ic->i_sends, 0, ic->i_send_ring.w_nr * sizeof(struct rds_ib_send_work)); 357 memset(ic->i_sends, 0, ic->i_send_ring.w_nr * sizeof(struct rds_ib_send_work));
357 358
358 ic->i_recvs = vmalloc(ic->i_recv_ring.w_nr * sizeof(struct rds_ib_recv_work)); 359 ic->i_recvs = vmalloc_node(ic->i_recv_ring.w_nr * sizeof(struct rds_ib_recv_work),
360 ibdev_to_node(dev));
359 if (!ic->i_recvs) { 361 if (!ic->i_recvs) {
360 ret = -ENOMEM; 362 ret = -ENOMEM;
361 rdsdebug("recv allocation failed\n"); 363 rdsdebug("recv allocation failed\n");
diff --git a/net/rds/ib_rdma.c b/net/rds/ib_rdma.c
index 7315fffd3bc8..cc341cd70c87 100644
--- a/net/rds/ib_rdma.c
+++ b/net/rds/ib_rdma.c
@@ -297,7 +297,7 @@ static struct rds_ib_mr *rds_ib_alloc_fmr(struct rds_ib_device *rds_ibdev)
297 rds_ib_flush_mr_pool(pool, 0); 297 rds_ib_flush_mr_pool(pool, 0);
298 } 298 }
299 299
300 ibmr = kzalloc(sizeof(*ibmr), GFP_KERNEL); 300 ibmr = kzalloc_node(sizeof(*ibmr), GFP_KERNEL, rdsibdev_to_node(rds_ibdev));
301 if (!ibmr) { 301 if (!ibmr) {
302 err = -ENOMEM; 302 err = -ENOMEM;
303 goto out_no_cigar; 303 goto out_no_cigar;
@@ -376,7 +376,8 @@ static int rds_ib_map_fmr(struct rds_ib_device *rds_ibdev, struct rds_ib_mr *ibm
376 if (page_cnt > fmr_message_size) 376 if (page_cnt > fmr_message_size)
377 return -EINVAL; 377 return -EINVAL;
378 378
379 dma_pages = kmalloc(sizeof(u64) * page_cnt, GFP_ATOMIC); 379 dma_pages = kmalloc_node(sizeof(u64) * page_cnt, GFP_ATOMIC,
380 rdsibdev_to_node(rds_ibdev));
380 if (!dma_pages) 381 if (!dma_pages)
381 return -ENOMEM; 382 return -ENOMEM;
382 383