diff mbox

[1/2] IB/mlx4: Suppress memory allocations warnings in kmalloc->__vmalloc flows

Message ID 1450337513-22609-1-git-send-email-leon@leon.nu (mailing list archive)
State Accepted
Headers show

Commit Message

Leon Romanovsky Dec. 17, 2015, 7:31 a.m. UTC
From: Leon Romanovsky <leonro@mellanox.com>

Failure in kmalloc memory allocations will throw a warning about it.
Such warnings are not needed anymore, since in commit 0ef2f05c7e02
("IB/mlx4: Use vmalloc for WR buffers when needed"), fallback mechanism
from kmalloc() to __vmalloc() was added.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/infiniband/hw/mlx4/qp.c  | 6 ++++--
 drivers/infiniband/hw/mlx4/srq.c | 3 ++-
 2 files changed, 6 insertions(+), 3 deletions(-)

Comments

Sagi Grimberg Dec. 17, 2015, 8:44 a.m. UTC | #1
Looks good,

Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Doug Ledford Dec. 24, 2015, 5:22 a.m. UTC | #2
On 12/17/2015 02:31 AM, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@mellanox.com>
> 
> Failure in kmalloc memory allocations will throw a warning about it.
> Such warnings are not needed anymore, since in commit 0ef2f05c7e02
> ("IB/mlx4: Use vmalloc for WR buffers when needed"), fallback mechanism
> from kmalloc() to __vmalloc() was added.
> 
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com>
> ---
>  drivers/infiniband/hw/mlx4/qp.c  | 6 ++++--
>  drivers/infiniband/hw/mlx4/srq.c | 3 ++-
>  2 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
> index 13eaaf45288f..dc86975fe1a9 100644
> --- a/drivers/infiniband/hw/mlx4/qp.c
> +++ b/drivers/infiniband/hw/mlx4/qp.c
> @@ -796,11 +796,13 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd,
>  		if (err)
>  			goto err_mtt;
>  
> -		qp->sq.wrid = kmalloc(qp->sq.wqe_cnt * sizeof(u64), gfp);
> +		qp->sq.wrid = kmalloc(qp->sq.wqe_cnt * sizeof(u64),
> +					gfp | __GFP_NOWARN);
>  		if (!qp->sq.wrid)
>  			qp->sq.wrid = __vmalloc(qp->sq.wqe_cnt * sizeof(u64),
>  						gfp, PAGE_KERNEL);
> -		qp->rq.wrid = kmalloc(qp->rq.wqe_cnt * sizeof(u64), gfp);
> +		qp->rq.wrid = kmalloc(qp->rq.wqe_cnt * sizeof(u64),
> +					gfp | __GFP_NOWARN);
>  		if (!qp->rq.wrid)
>  			qp->rq.wrid = __vmalloc(qp->rq.wqe_cnt * sizeof(u64),
>  						gfp, PAGE_KERNEL);
> diff --git a/drivers/infiniband/hw/mlx4/srq.c b/drivers/infiniband/hw/mlx4/srq.c
> index 8d133c40fa0e..f416c7463827 100644
> --- a/drivers/infiniband/hw/mlx4/srq.c
> +++ b/drivers/infiniband/hw/mlx4/srq.c
> @@ -171,7 +171,8 @@ struct ib_srq *mlx4_ib_create_srq(struct ib_pd *pd,
>  		if (err)
>  			goto err_mtt;
>  
> -		srq->wrid = kmalloc(srq->msrq.max * sizeof (u64), GFP_KERNEL);
> +		srq->wrid = kmalloc(srq->msrq.max * sizeof(u64),
> +					GFP_KERNEL | __GFP_NOWARN);
>  		if (!srq->wrid) {
>  			srq->wrid = __vmalloc(srq->msrq.max * sizeof(u64),
>  					      GFP_KERNEL, PAGE_KERNEL);
> 

Applied with some edits to the commit message, thanks.
diff mbox

Patch

diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index 13eaaf45288f..dc86975fe1a9 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -796,11 +796,13 @@  static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd,
 		if (err)
 			goto err_mtt;
 
-		qp->sq.wrid = kmalloc(qp->sq.wqe_cnt * sizeof(u64), gfp);
+		qp->sq.wrid = kmalloc(qp->sq.wqe_cnt * sizeof(u64),
+					gfp | __GFP_NOWARN);
 		if (!qp->sq.wrid)
 			qp->sq.wrid = __vmalloc(qp->sq.wqe_cnt * sizeof(u64),
 						gfp, PAGE_KERNEL);
-		qp->rq.wrid = kmalloc(qp->rq.wqe_cnt * sizeof(u64), gfp);
+		qp->rq.wrid = kmalloc(qp->rq.wqe_cnt * sizeof(u64),
+					gfp | __GFP_NOWARN);
 		if (!qp->rq.wrid)
 			qp->rq.wrid = __vmalloc(qp->rq.wqe_cnt * sizeof(u64),
 						gfp, PAGE_KERNEL);
diff --git a/drivers/infiniband/hw/mlx4/srq.c b/drivers/infiniband/hw/mlx4/srq.c
index 8d133c40fa0e..f416c7463827 100644
--- a/drivers/infiniband/hw/mlx4/srq.c
+++ b/drivers/infiniband/hw/mlx4/srq.c
@@ -171,7 +171,8 @@  struct ib_srq *mlx4_ib_create_srq(struct ib_pd *pd,
 		if (err)
 			goto err_mtt;
 
-		srq->wrid = kmalloc(srq->msrq.max * sizeof (u64), GFP_KERNEL);
+		srq->wrid = kmalloc(srq->msrq.max * sizeof(u64),
+					GFP_KERNEL | __GFP_NOWARN);
 		if (!srq->wrid) {
 			srq->wrid = __vmalloc(srq->msrq.max * sizeof(u64),
 					      GFP_KERNEL, PAGE_KERNEL);