]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.15.17/ib-rdmavt-allocate-cq-memory-on-the-correct-node.patch
Linux 4.14.95
[thirdparty/kernel/stable-queue.git] / releases / 4.15.17 / ib-rdmavt-allocate-cq-memory-on-the-correct-node.patch
1 From foo@baz Mon Apr 9 10:16:32 CEST 2018
2 From: Mike Marciniszyn <mike.marciniszyn@intel.com>
3 Date: Mon, 18 Dec 2017 19:57:06 -0800
4 Subject: IB/rdmavt: Allocate CQ memory on the correct node
5
6 From: Mike Marciniszyn <mike.marciniszyn@intel.com>
7
8
9 [ Upstream commit db9a2c6f9b6196b889b98e961cb9a37617b11ccf ]
10
11 CQ allocation does not ensure that completion queue entries
12 and the completion queue structure are allocated on the correct
13 numa node.
14
15 Fix by allocating the rvt_cq and kernel CQ entries on the device node,
16 leaving the user CQ entries on the default local node. Also ensure
17 CQ resizes use the correct allocator when extending a CQ.
18
19 Reviewed-by: Sebastian Sanchez <sebastian.sanchez@intel.com>
20 Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
21 Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
22 Signed-off-by: Doug Ledford <dledford@redhat.com>
23 Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
24 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25 ---
26 drivers/infiniband/sw/rdmavt/cq.c | 10 +++++++---
27 1 file changed, 7 insertions(+), 3 deletions(-)
28
29 --- a/drivers/infiniband/sw/rdmavt/cq.c
30 +++ b/drivers/infiniband/sw/rdmavt/cq.c
31 @@ -198,7 +198,7 @@ struct ib_cq *rvt_create_cq(struct ib_de
32 return ERR_PTR(-EINVAL);
33
34 /* Allocate the completion queue structure. */
35 - cq = kzalloc(sizeof(*cq), GFP_KERNEL);
36 + cq = kzalloc_node(sizeof(*cq), GFP_KERNEL, rdi->dparms.node);
37 if (!cq)
38 return ERR_PTR(-ENOMEM);
39
40 @@ -214,7 +214,9 @@ struct ib_cq *rvt_create_cq(struct ib_de
41 sz += sizeof(struct ib_uverbs_wc) * (entries + 1);
42 else
43 sz += sizeof(struct ib_wc) * (entries + 1);
44 - wc = vmalloc_user(sz);
45 + wc = udata ?
46 + vmalloc_user(sz) :
47 + vzalloc_node(sz, rdi->dparms.node);
48 if (!wc) {
49 ret = ERR_PTR(-ENOMEM);
50 goto bail_cq;
51 @@ -369,7 +371,9 @@ int rvt_resize_cq(struct ib_cq *ibcq, in
52 sz += sizeof(struct ib_uverbs_wc) * (cqe + 1);
53 else
54 sz += sizeof(struct ib_wc) * (cqe + 1);
55 - wc = vmalloc_user(sz);
56 + wc = udata ?
57 + vmalloc_user(sz) :
58 + vzalloc_node(sz, rdi->dparms.node);
59 if (!wc)
60 return -ENOMEM;
61