From patchwork Sun Nov 18 13:21:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhu Yanjun X-Patchwork-Id: 10687885 X-Patchwork-Delegate: jgg@ziepe.ca Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4DF5615A7 for ; Sun, 18 Nov 2018 13:21:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 32C0529C76 for ; Sun, 18 Nov 2018 13:21:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 227C729C9A; Sun, 18 Nov 2018 13:21:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD9CF29C76 for ; Sun, 18 Nov 2018 13:21:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726626AbeKRXjN (ORCPT ); Sun, 18 Nov 2018 18:39:13 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:45768 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726596AbeKRXjM (ORCPT ); Sun, 18 Nov 2018 18:39:12 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wAID8w0n002349; Sun, 18 Nov 2018 13:18:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id; s=corp-2018-07-02; bh=n2CAJ0FxTWaGzFm+vgu6hrn+hlmrGgQ7bjKqumw+l/w=; b=fhA+XDxiOcWBf4Wya53WcHzck3TkCgwYyrWo/s0oDVl1PHVujo0krdXMLZ3TirYWAvvy 91xBcfYEfK6S8bF9d2YvPlKkoYqjBUWDfNjrBqXFodby1ESdKodzKx2EwTRGr0OU88Od A7UvLYHGMw8O7HcwOwQ42WyrvG1787x7zNwdWGOf845YaRA/zikonDWiDT8EK9PZaIM2 f8/sHeri79u8if2C5YBrjxzTRZpubUnA1oNiYUhbVZB5GuM3nXlmKBPUBAa5j1MbyHVZ Z6bQ5Ydql/h/5RaxWt2yQHVKXh9tx6ygDwWwMUGoZ7wbwGQornfli+HlMLVkGeBDYsrK Mg== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2120.oracle.com with ESMTP id 2ntbmqan0t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 18 Nov 2018 13:18:46 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id wAIDIjY2002427 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 18 Nov 2018 13:18:45 GMT Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id wAIDIhhi011471; Sun, 18 Nov 2018 13:18:43 GMT Received: from shipfan.cn.oracle.com (/10.113.210.105) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 18 Nov 2018 05:18:43 -0800 From: Zhu Yanjun To: monis@mellanox.com, dledford@redhat.com, jgg@ziepe.ca, linux-rdma@vger.kernel.org Subject: [PATCH 1/1] IB/rxe: use kvmalloc instead of kmalloc Date: Sun, 18 Nov 2018 08:21:24 -0500 Message-Id: <1542547284-4115-1-git-send-email-yanjun.zhu@oracle.com> X-Mailer: git-send-email 2.7.4 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9080 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=934 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811180125 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Attempt to allocate physically contiguous memory, but upon failure, fall back to non-contiguous (vmalloc) allocation. Signed-off-by: Zhu Yanjun --- drivers/infiniband/sw/rxe/rxe_cq.c | 2 +- drivers/infiniband/sw/rxe/rxe_qp.c | 4 ++-- drivers/infiniband/sw/rxe/rxe_queue.c | 6 +++--- drivers/infiniband/sw/rxe/rxe_srq.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_cq.c b/drivers/infiniband/sw/rxe/rxe_cq.c index a57276f2cb84..b85ca024fa58 100644 --- a/drivers/infiniband/sw/rxe/rxe_cq.c +++ b/drivers/infiniband/sw/rxe/rxe_cq.c @@ -98,7 +98,7 @@ int rxe_cq_from_init(struct rxe_dev *rxe, struct rxe_cq *cq, int cqe, cq->queue->buf, cq->queue->buf_size, &cq->queue->ip); if (err) { vfree(cq->queue->buf); - kfree(cq->queue); + kvfree(cq->queue); return err; } diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c index b9710907dac2..fd233f93ac1d 100644 --- a/drivers/infiniband/sw/rxe/rxe_qp.c +++ b/drivers/infiniband/sw/rxe/rxe_qp.c @@ -259,7 +259,7 @@ static int rxe_qp_init_req(struct rxe_dev *rxe, struct rxe_qp *qp, if (err) { vfree(qp->sq.queue->buf); - kfree(qp->sq.queue); + kvfree(qp->sq.queue); return err; } @@ -312,7 +312,7 @@ static int rxe_qp_init_resp(struct rxe_dev *rxe, struct rxe_qp *qp, &qp->rq.queue->ip); if (err) { vfree(qp->rq.queue->buf); - kfree(qp->rq.queue); + kvfree(qp->rq.queue); return err; } } diff --git a/drivers/infiniband/sw/rxe/rxe_queue.c b/drivers/infiniband/sw/rxe/rxe_queue.c index f84ab4469261..e811a655b286 100644 --- a/drivers/infiniband/sw/rxe/rxe_queue.c +++ b/drivers/infiniband/sw/rxe/rxe_queue.c @@ -91,7 +91,7 @@ struct rxe_queue *rxe_queue_init(struct rxe_dev *rxe, if (*num_elem < 0) goto err1; - q = kmalloc(sizeof(*q), GFP_KERNEL); + q = kvmalloc(sizeof(*q), GFP_KERNEL); if (!q) goto err1; @@ -174,7 +174,7 @@ int rxe_queue_resize(struct rxe_queue *q, new_q->buf_size, &new_q->ip); if (err) { vfree(new_q->buf); - kfree(new_q); + kvfree(new_q); goto err1; } @@ -208,5 +208,5 @@ void rxe_queue_cleanup(struct rxe_queue *q) else vfree(q->buf); - kfree(q); + kvfree(q); } diff --git a/drivers/infiniband/sw/rxe/rxe_srq.c b/drivers/infiniband/sw/rxe/rxe_srq.c index c41a5fee81f7..c9969d157b87 100644 --- a/drivers/infiniband/sw/rxe/rxe_srq.c +++ b/drivers/infiniband/sw/rxe/rxe_srq.c @@ -132,7 +132,7 @@ int rxe_srq_from_init(struct rxe_dev *rxe, struct rxe_srq *srq, q->buf_size, &q->ip); if (err) { vfree(q->buf); - kfree(q); + kvfree(q); return err; }