Skip to content

Commit

Permalink
IB/rdmavt: Add Mem affinity support
Browse files Browse the repository at this point in the history
Change verbs memory allocations to the device numa node.  This keeps memory
close to the device for optimal performance.

Reviewed-by: Dean Luick <[email protected]>
Reviewed-by: Mike Marciniszyn <[email protected]>
Reviewed-by: Ira Weiny <[email protected]>
Reviewed-by: Dennis Dalessandro <[email protected]>
Signed-off-by: Mitko Haralanov <[email protected]>
Signed-off-by: Doug Ledford <[email protected]>
  • Loading branch information
dhharala authored and dledford committed Mar 11, 2016
1 parent 60c30f5 commit d1b697b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion drivers/infiniband/sw/rdmavt/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ struct rvt_mmap_info *rvt_create_mmap_info(struct rvt_dev_info *rdi,
{
struct rvt_mmap_info *ip;

ip = kmalloc(sizeof(*ip), GFP_KERNEL);
ip = kmalloc_node(sizeof(*ip), GFP_KERNEL, rdi->dparms.node);
if (!ip)
return ip;

Expand Down
2 changes: 1 addition & 1 deletion drivers/infiniband/sw/rdmavt/mr.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ int rvt_driver_mr_init(struct rvt_dev_info *rdi)
}
lk_tab_size = rdi->lkey_table.max * sizeof(*rdi->lkey_table.table);
rdi->lkey_table.table = (struct rvt_mregion __rcu **)
vmalloc(lk_tab_size);
vmalloc_node(lk_tab_size, rdi->dparms.node);
if (!rdi->lkey_table.table)
return -ENOMEM;

Expand Down
21 changes: 12 additions & 9 deletions drivers/infiniband/sw/rdmavt/qp.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,17 +186,18 @@ int rvt_driver_qp_init(struct rvt_dev_info *rdi)
return -EINVAL;

/* allocate parent object */
rdi->qp_dev = kzalloc(sizeof(*rdi->qp_dev), GFP_KERNEL);
rdi->qp_dev = kzalloc_node(sizeof(*rdi->qp_dev), GFP_KERNEL,
rdi->dparms.node);
if (!rdi->qp_dev)
return -ENOMEM;

/* allocate hash table */
rdi->qp_dev->qp_table_size = rdi->dparms.qp_table_size;
rdi->qp_dev->qp_table_bits = ilog2(rdi->dparms.qp_table_size);
rdi->qp_dev->qp_table =
kmalloc(rdi->qp_dev->qp_table_size *
sizeof(*rdi->qp_dev->qp_table),
GFP_KERNEL);
kmalloc_node(rdi->qp_dev->qp_table_size *
sizeof(*rdi->qp_dev->qp_table),
GFP_KERNEL, rdi->dparms.node);
if (!rdi->qp_dev->qp_table)
goto no_qp_table;

Expand Down Expand Up @@ -542,8 +543,9 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
(init_attr->cap.max_send_wr + 1) * sz,
gfp, PAGE_KERNEL);
else
swq = vmalloc(
(init_attr->cap.max_send_wr + 1) * sz);
swq = vmalloc_node(
(init_attr->cap.max_send_wr + 1) * sz,
rdi->dparms.node);
if (!swq)
return ERR_PTR(-ENOMEM);

Expand All @@ -558,7 +560,7 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
} else if (init_attr->cap.max_recv_sge > 1)
sg_list_sz = sizeof(*qp->r_sg_list) *
(init_attr->cap.max_recv_sge - 1);
qp = kzalloc(sz + sg_list_sz, gfp);
qp = kzalloc_node(sz + sg_list_sz, gfp, rdi->dparms.node);
if (!qp)
goto bail_swq;

Expand Down Expand Up @@ -592,9 +594,10 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
qp->r_rq.size * sz,
gfp, PAGE_KERNEL);
else
qp->r_rq.wq = vmalloc(
qp->r_rq.wq = vmalloc_node(
sizeof(struct rvt_rwq) +
qp->r_rq.size * sz);
qp->r_rq.size * sz,
rdi->dparms.node);
if (!qp->r_rq.wq)
goto bail_driver_priv;
}
Expand Down

0 comments on commit d1b697b

Please sign in to comment.