Return-Path: Received: from mail-co1nam03on0123.outbound.protection.outlook.com ([104.47.40.123]:22550 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965374AbeCSQCE (ORCPT ); Mon, 19 Mar 2018 12:02:04 -0400 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Mike Marciniszyn , Dennis Dalessandro , Doug Ledford , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 144/281] IB/rdmavt: Allocate CQ memory on the correct node Date: Mon, 19 Mar 2018 16:00:44 +0000 Message-ID: <20180319155742.13731-144-alexander.levin@microsoft.com> References: <20180319155742.13731-1-alexander.levin@microsoft.com> In-Reply-To: <20180319155742.13731-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Mike Marciniszyn [ Upstream commit db9a2c6f9b6196b889b98e961cb9a37617b11ccf ] CQ allocation does not ensure that completion queue entries and the completion queue structure are allocated on the correct numa node. Fix by allocating the rvt_cq and kernel CQ entries on the device node, leaving the user CQ entries on the default local node. Also ensure CQ resizes use the correct allocator when extending a CQ. Reviewed-by: Sebastian Sanchez Signed-off-by: Mike Marciniszyn Signed-off-by: Dennis Dalessandro Signed-off-by: Doug Ledford Signed-off-by: Sasha Levin --- drivers/infiniband/sw/rdmavt/cq.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/sw/rdmavt/cq.c b/drivers/infiniband/sw/rdma= vt/cq.c index 6d9904a4a0ab..29dc5278d7be 100644 --- a/drivers/infiniband/sw/rdmavt/cq.c +++ b/drivers/infiniband/sw/rdmavt/cq.c @@ -197,7 +197,7 @@ struct ib_cq *rvt_create_cq(struct ib_device *ibdev, return ERR_PTR(-EINVAL); =20 /* Allocate the completion queue structure. */ - cq =3D kzalloc(sizeof(*cq), GFP_KERNEL); + cq =3D kzalloc_node(sizeof(*cq), GFP_KERNEL, rdi->dparms.node); if (!cq) return ERR_PTR(-ENOMEM); =20 @@ -213,7 +213,9 @@ struct ib_cq *rvt_create_cq(struct ib_device *ibdev, sz +=3D sizeof(struct ib_uverbs_wc) * (entries + 1); else sz +=3D sizeof(struct ib_wc) * (entries + 1); - wc =3D vmalloc_user(sz); + wc =3D udata ? + vmalloc_user(sz) : + vzalloc_node(sz, rdi->dparms.node); if (!wc) { ret =3D ERR_PTR(-ENOMEM); goto bail_cq; @@ -368,7 +370,9 @@ int rvt_resize_cq(struct ib_cq *ibcq, int cqe, struct i= b_udata *udata) sz +=3D sizeof(struct ib_uverbs_wc) * (cqe + 1); else sz +=3D sizeof(struct ib_wc) * (cqe + 1); - wc =3D vmalloc_user(sz); + wc =3D udata ? + vmalloc_user(sz) : + vzalloc_node(sz, rdi->dparms.node); if (!wc) return -ENOMEM; =20 --=20 2.14.1