IB/mlx4: Suppress memory allocations warnings in kmalloc->__vmalloc flows
Subsystems (2)
PATCH 1/2 IB/mlx4: Suppress memory allocations warnings in kmalloc->__vmalloc flows
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
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.
--- drivers/infiniband/hw/mlx4/qp.c | 6 ++++-- drivers/infiniband/hw/mlx4/srq.c | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-)
drivers/infiniband/hw/mlx4/qp.c +4 -2
@@ -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 );
drivers/infiniband/hw/mlx4/srq.c +2 -1
@@ -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 );
Signature · 6 lines
1.7.12.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1450337513-22609-1-git-send-email-leon-2ukJVAZIZ/[email protected]
PATCH 2/2 IB/mlx4: Convert kmalloc to be kmalloc_array to fix checkpatch warnings
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
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),
--- drivers/infiniband/hw/mlx4/qp.c | 4 ++-- drivers/infiniband/hw/mlx4/srq.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/infiniband/hw/mlx4/qp.c +2 -2
@@ -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),
drivers/infiniband/hw/mlx4/srq.c +1 -1
@@ -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),
Signature · 6 lines
1.7.12.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1450337513-22609-2-git-send-email-leon-2ukJVAZIZ/[email protected]
Sagi Grimberg
Reviewed-byRe: [PATCH 2/2] IB/mlx4: Convert kmalloc to be kmalloc_array to fix checkpatch warnings
Looks good,
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] IB/mlx4: Convert kmalloc to be kmalloc_array to fix checkpatch warnings
In reply to a message not in the archiveQuoted 45 lines · Leon Romanovsky
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
Convert kmalloc to be
kmalloc_arrayto fix warnings below:WARNING: Prefer
kmalloc_arrayover kmalloc with multiply
+qp->sq.wrid= kmalloc(qp->sq.wqe_cnt * sizeof(u64),WARNING: Prefer
kmalloc_arrayover kmalloc with multiply
+qp->rq.wrid= kmalloc(qp->rq.wqe_cnt * sizeof(u64),WARNING: Prefer
kmalloc_arrayover kmalloc with multiply
+srq->wrid= kmalloc(srq->msrq.max * sizeof(u64),--- drivers/infiniband/hw/mlx4/qp.c | 4 ++-- drivers/infiniband/hw/mlx4/srq.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)drivers/infiniband/hw/mlx4/qp.c +2
-2@@ -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),drivers/infiniband/hw/mlx4/srq.c +0
-0
drivers/infiniband/hw/mlx4/srq.c struct ib_srq *mlx4_ib_create_srq(struct ib_pd *pd, · line 177
Quoted 8 lines
drivers/infiniband/hw/mlx4/srq.c +1
-1@@ -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.
Signature · 2 lines
Doug Ledford <[email protected]> GPG KeyID: 0E572FDD
Sagi Grimberg
Reviewed-byLooks good,
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 40 lines · Leon Romanovsky
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
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 fromkmalloc()to__vmalloc()was added.--- drivers/infiniband/hw/mlx4/qp.c | 6 ++++-- drivers/infiniband/hw/mlx4/srq.c | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-)drivers/infiniband/hw/mlx4/qp.c +4
-2@@ -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 );drivers/infiniband/hw/mlx4/srq.c +0
-0
drivers/infiniband/hw/mlx4/srq.c struct ib_srq *mlx4_ib_create_srq(struct ib_pd *pd, · line 178
Quoted 9 lines
drivers/infiniband/hw/mlx4/srq.c +2
-1@@ -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.
Signature · 2 lines
Doug Ledford <[email protected]> GPG KeyID: 0E572FDD