Re: [PATCH] IB/mlx5: fall back to vmalloc for mlx5_ib_wq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm so out of touch with the new interfaces in the kernel.
Will post updated patch.

Thanks
Dongyang
On Wed, 2017-08-16 at 15:12 +0300, Leon Romanovsky wrote:
> On Wed, Aug 16, 2017 at 09:06:32PM +1000, Li Dongyang wrote:
> > We observed multiple times on our Lustre OSS servers that when
> > the system memory is fragmented, kmalloc() in create_kernel_qp()
> > could fail order 4/5 allocations while we still have many free
> > pages.
> > 
> > Fall back to vmalloc to allow the operation to contine, also switch
> > to kmalloc_array() from kmalloc().
> > 
> > Signed-off-by: Li Dongyang <dongyang.li@xxxxxxxxxx>
> > ---
> >  drivers/infiniband/hw/mlx5/qp.c  | 54
> > +++++++++++++++++++++++++++++-----------
> >  drivers/infiniband/hw/mlx5/srq.c |  8 ++++--
> >  2 files changed, 45 insertions(+), 17 deletions(-)
> > 
> > diff --git a/drivers/infiniband/hw/mlx5/qp.c
> > b/drivers/infiniband/hw/mlx5/qp.c
> > index 0889ff367c86..e662fa5af5bb 100644
> > --- a/drivers/infiniband/hw/mlx5/qp.c
> > +++ b/drivers/infiniband/hw/mlx5/qp.c
> > @@ -959,11 +959,35 @@ static int create_kernel_qp(struct
> > mlx5_ib_dev *dev,
> >  		goto err_free;
> >  	}
> > 
> > -	qp->sq.wrid = kmalloc(qp->sq.wqe_cnt * sizeof(*qp-
> > >sq.wrid), GFP_KERNEL);
> > -	qp->sq.wr_data = kmalloc(qp->sq.wqe_cnt * sizeof(*qp-
> > >sq.wr_data), GFP_KERNEL);
> > -	qp->rq.wrid = kmalloc(qp->rq.wqe_cnt * sizeof(*qp-
> > >rq.wrid), GFP_KERNEL);
> > -	qp->sq.w_list = kmalloc(qp->sq.wqe_cnt * sizeof(*qp-
> > >sq.w_list), GFP_KERNEL);
> > -	qp->sq.wqe_head = kmalloc(qp->sq.wqe_cnt * sizeof(*qp-
> > >sq.wqe_head), GFP_KERNEL);
> > +	qp->sq.wrid = kmalloc_array(qp->sq.wqe_cnt, sizeof(*qp-
> > >sq.wrid),
> > +				    GFP_KERNEL | __GFP_NOWARN);
> > +	if (!qp->sq.wrid)
> > +		qp->sq.wrid = __vmalloc(qp->sq.wqe_cnt *
> > sizeof(*qp->sq.wrid),
> > +					GFP_KERNEL, PAGE_KERNEL);
> 
> Please don't open code, the kvmalloc and kvmalloc_array functions.
> 
> Thanks for doing it.��.n��������+%������w��{.n�����{���fk��ܨ}���Ơz�j:+v�����w����ޙ��&�)ߡ�a����z�ޗ���ݢj��w�f




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux