IB/mlx4: Allocation of CQ resize structure doesn't need to be atomic
Subsystems (2)
PATCH 1/1 IB/mlx4: Allocation of CQ resize structure doesn't need to be atomic
From: Roland Dreier <[email protected]>
We allocate a small tracking structure as part of mlx4_ib_resize_cq(). However, we don't need to use GFP_ATOMIC -- immediately after the allocation, we call mlx4_cq_resize(), which allocates a command mailbox with GFP_KERNEL and then sleeps on a firmware command, so we better not be in an atomic context.
This actually has a real impact, because when this GFP_ATOMIC allocation fails (and GFP_ATOMIC does fail in practice) then a userspace consumer resizing a CQ will get a spurious failure that we can easily avoid.
--- drivers/infiniband/hw/mlx4/cq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/hw/mlx4/cq.c +2 -2
@@ -288,7 +288,7 @@ static int mlx4_alloc_resize_buf(struct mlx4_ib_dev *dev, struct mlx4_ib_cq *cq,if (cq->resize_buf)return -EBUSY ; - cq->resize_buf =kmalloc (sizeof *cq->resize_buf,GFP_ATOMIC ); + cq->resize_buf =kmalloc (sizeof *cq->resize_buf,GFP_KERNEL );if (!cq->resize_buf)return -ENOMEM ;
@@ -316,7 +316,7 @@ static int mlx4_alloc_resize_umem(struct mlx4_ib_dev *dev, struct mlx4_ib_cq *cqif (ib_copy_from_udata (&ucmd, udata,sizeof ucmd))return -EFAULT ; - cq->resize_buf =kmalloc (sizeof *cq->resize_buf,GFP_ATOMIC ); + cq->resize_buf =kmalloc (sizeof *cq->resize_buf,GFP_KERNEL );if (!cq->resize_buf)return -ENOMEM ;
Signature · 6 lines
2.7.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): 1469768323-8093-1-git-send-email-roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Leon Romanovsky
Reviewed-byQuoted 8 lines · Roland Dreier
From: Roland Dreier <[email protected]>
We allocate a small tracking structure as part of
mlx4_ib_resize_cq(). However, we don't need to useGFP_ATOMIC-- immediately after the allocation, we callmlx4_cq_resize(), which allocates a command mailbox withGFP_KERNELand then sleeps on a firmware command, so we better not be in an atomic context.
Quoted 6 lines
This actually has a real impact, because when this
GFP_ATOMICallocation fails (andGFP_ATOMICdoes fail in practice) then a userspace consumer resizing a CQ will get a spurious failure that we can easily avoid.Signed-off-by Roland Dreier <[email protected]>
Thanks,
Quoted 9 lines · Roland Dreier
From: Roland Dreier <[email protected]>
We allocate a small tracking structure as part of
mlx4_ib_resize_cq().
However, we don't need to useGFP_ATOMIC-- immediately after the allocation, we callmlx4_cq_resize(), which allocates a command mailbox withGFP_KERNELand then sleeps on a firmware command, so we better not be in an atomic context.
Quoted 7 lines
This actually has a real impact, because when this
GFP_ATOMICallocation fails (andGFP_ATOMICdoes fail in practice) then a userspace consumer resizing a CQ will get a spurious failure that we can easily avoid.Signed-off-by Roland Dreier <[email protected]>
Thanks, I reworded the commit subject for length and applied.
Signature · 2 lines
Doug Ledford <[email protected]> GPG KeyID: 0E572FDD