linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] IB/mlx4: Suppress memory allocations warnings in kmalloc->__vmalloc flows
@ 2015-12-17  7:31 Leon Romanovsky
       [not found] ` <1450337513-22609-1-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Leon Romanovsky @ 2015-12-17  7:31 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky

From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

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-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Reviewed-by: Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 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);
-- 
1.7.12.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] IB/mlx4: Convert kmalloc to be kmalloc_array to fix checkpatch warnings
       [not found] ` <1450337513-22609-1-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
@ 2015-12-17  7:31   ` Leon Romanovsky
       [not found]     ` <1450337513-22609-2-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
  2015-12-17  8:44   ` [PATCH 1/2] IB/mlx4: Suppress memory allocations warnings in kmalloc->__vmalloc flows Sagi Grimberg
  2015-12-24  5:22   ` Doug Ledford
  2 siblings, 1 reply; 6+ messages in thread
From: Leon Romanovsky @ 2015-12-17  7:31 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky

From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Convert kmalloc to be kmalloc_array to fix warnings below:

WARNING: Prefer kmalloc_array over kmalloc with multiply
+               qp->sq.wrid = kmalloc(qp->sq.wqe_cnt * sizeof(u64),

WARNING: Prefer kmalloc_array over kmalloc with multiply
+               qp->rq.wrid = kmalloc(qp->rq.wqe_cnt * sizeof(u64),

WARNING: Prefer kmalloc_array over kmalloc with multiply
+               srq->wrid = kmalloc(srq->msrq.max * sizeof(u64),

Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Reviewed-by: Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 drivers/infiniband/hw/mlx4/qp.c  | 4 ++--
 drivers/infiniband/hw/mlx4/srq.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index dc86975fe1a9..70de13ed9da7 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -796,12 +796,12 @@ 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),
+		qp->sq.wrid = kmalloc_array(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),
+		qp->rq.wrid = kmalloc_array(qp->rq.wqe_cnt, sizeof(u64),
 					gfp | __GFP_NOWARN);
 		if (!qp->rq.wrid)
 			qp->rq.wrid = __vmalloc(qp->rq.wqe_cnt * sizeof(u64),
diff --git a/drivers/infiniband/hw/mlx4/srq.c b/drivers/infiniband/hw/mlx4/srq.c
index f416c7463827..68d5a5fda271 100644
--- a/drivers/infiniband/hw/mlx4/srq.c
+++ b/drivers/infiniband/hw/mlx4/srq.c
@@ -171,7 +171,7 @@ struct ib_srq *mlx4_ib_create_srq(struct ib_pd *pd,
 		if (err)
 			goto err_mtt;
 
-		srq->wrid = kmalloc(srq->msrq.max * sizeof(u64),
+		srq->wrid = kmalloc_array(srq->msrq.max, sizeof(u64),
 					GFP_KERNEL | __GFP_NOWARN);
 		if (!srq->wrid) {
 			srq->wrid = __vmalloc(srq->msrq.max * sizeof(u64),
-- 
1.7.12.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] IB/mlx4: Suppress memory allocations warnings in kmalloc->__vmalloc flows
       [not found] ` <1450337513-22609-1-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
  2015-12-17  7:31   ` [PATCH 2/2] IB/mlx4: Convert kmalloc to be kmalloc_array to fix checkpatch warnings Leon Romanovsky
@ 2015-12-17  8:44   ` Sagi Grimberg
  2015-12-24  5:22   ` Doug Ledford
  2 siblings, 0 replies; 6+ messages in thread
From: Sagi Grimberg @ 2015-12-17  8:44 UTC (permalink / raw)
  To: Leon Romanovsky, dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky

Looks good,

Reviewed-by: Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] IB/mlx4: Convert kmalloc to be kmalloc_array to fix checkpatch warnings
       [not found]     ` <1450337513-22609-2-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
@ 2015-12-17  8:44       ` Sagi Grimberg
  2015-12-24  5:22       ` Doug Ledford
  1 sibling, 0 replies; 6+ messages in thread
From: Sagi Grimberg @ 2015-12-17  8:44 UTC (permalink / raw)
  To: Leon Romanovsky, dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky

Looks good,

Reviewed-by: Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] IB/mlx4: Suppress memory allocations warnings in kmalloc->__vmalloc flows
       [not found] ` <1450337513-22609-1-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
  2015-12-17  7:31   ` [PATCH 2/2] IB/mlx4: Convert kmalloc to be kmalloc_array to fix checkpatch warnings Leon Romanovsky
  2015-12-17  8:44   ` [PATCH 1/2] IB/mlx4: Suppress memory allocations warnings in kmalloc->__vmalloc flows Sagi Grimberg
@ 2015-12-24  5:22   ` Doug Ledford
  2 siblings, 0 replies; 6+ messages in thread
From: Doug Ledford @ 2015-12-24  5:22 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky

[-- Attachment #1: Type: text/plain, Size: 2369 bytes --]

On 12/17/2015 02:31 AM, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 
> 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-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Reviewed-by: Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> ---
>  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.

-- 
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
              GPG KeyID: 0E572FDD



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] IB/mlx4: Convert kmalloc to be kmalloc_array to fix checkpatch warnings
       [not found]     ` <1450337513-22609-2-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
  2015-12-17  8:44       ` Sagi Grimberg
@ 2015-12-24  5:22       ` Doug Ledford
  1 sibling, 0 replies; 6+ messages in thread
From: Doug Ledford @ 2015-12-24  5:22 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky

[-- Attachment #1: Type: text/plain, Size: 2488 bytes --]

On 12/17/2015 02:31 AM, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 
> Convert kmalloc to be kmalloc_array to fix warnings below:
> 
> WARNING: Prefer kmalloc_array over kmalloc with multiply
> +               qp->sq.wrid = kmalloc(qp->sq.wqe_cnt * sizeof(u64),
> 
> WARNING: Prefer kmalloc_array over kmalloc with multiply
> +               qp->rq.wrid = kmalloc(qp->rq.wqe_cnt * sizeof(u64),
> 
> WARNING: Prefer kmalloc_array over kmalloc with multiply
> +               srq->wrid = kmalloc(srq->msrq.max * sizeof(u64),
> 
> Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Reviewed-by: Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> ---
>  drivers/infiniband/hw/mlx4/qp.c  | 4 ++--
>  drivers/infiniband/hw/mlx4/srq.c | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
> index dc86975fe1a9..70de13ed9da7 100644
> --- a/drivers/infiniband/hw/mlx4/qp.c
> +++ b/drivers/infiniband/hw/mlx4/qp.c
> @@ -796,12 +796,12 @@ 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),
> +		qp->sq.wrid = kmalloc_array(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),
> +		qp->rq.wrid = kmalloc_array(qp->rq.wqe_cnt, sizeof(u64),
>  					gfp | __GFP_NOWARN);
>  		if (!qp->rq.wrid)
>  			qp->rq.wrid = __vmalloc(qp->rq.wqe_cnt * sizeof(u64),
> diff --git a/drivers/infiniband/hw/mlx4/srq.c b/drivers/infiniband/hw/mlx4/srq.c
> index f416c7463827..68d5a5fda271 100644
> --- a/drivers/infiniband/hw/mlx4/srq.c
> +++ b/drivers/infiniband/hw/mlx4/srq.c
> @@ -171,7 +171,7 @@ struct ib_srq *mlx4_ib_create_srq(struct ib_pd *pd,
>  		if (err)
>  			goto err_mtt;
>  
> -		srq->wrid = kmalloc(srq->msrq.max * sizeof(u64),
> +		srq->wrid = kmalloc_array(srq->msrq.max, sizeof(u64),
>  					GFP_KERNEL | __GFP_NOWARN);
>  		if (!srq->wrid) {
>  			srq->wrid = __vmalloc(srq->msrq.max * sizeof(u64),
> 

Applied with some edits to the commit message, thanks.

-- 
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
              GPG KeyID: 0E572FDD



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-12-24  5:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-17  7:31 [PATCH 1/2] IB/mlx4: Suppress memory allocations warnings in kmalloc->__vmalloc flows Leon Romanovsky
     [not found] ` <1450337513-22609-1-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
2015-12-17  7:31   ` [PATCH 2/2] IB/mlx4: Convert kmalloc to be kmalloc_array to fix checkpatch warnings Leon Romanovsky
     [not found]     ` <1450337513-22609-2-git-send-email-leon-2ukJVAZIZ/Y@public.gmane.org>
2015-12-17  8:44       ` Sagi Grimberg
2015-12-24  5:22       ` Doug Ledford
2015-12-17  8:44   ` [PATCH 1/2] IB/mlx4: Suppress memory allocations warnings in kmalloc->__vmalloc flows Sagi Grimberg
2015-12-24  5:22   ` Doug Ledford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).