Re: [PATCH 09/32] mlx4: Convert pv_id_table to XArray

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

 



On Thu, Feb 21, 2019 at 11:28:49AM -0700, Jason Gunthorpe wrote:
> On Wed, Feb 20, 2019 at 04:20:44PM -0800, Matthew Wilcox wrote:
> > @@ -256,25 +252,19 @@ id_map_alloc(struct ib_device *ibdev, int slave_id, u32 sl_cm_id)
> >  	ent->dev = to_mdev(ibdev);
> >  	INIT_DELAYED_WORK(&ent->timeout, id_map_ent_timeout);
> >  
> > -	idr_preload(GFP_KERNEL);
> > -	spin_lock(&to_mdev(ibdev)->sriov.id_map_lock);
> > -
> > -	ret = idr_alloc_cyclic(&sriov->pv_id_table, ent, 0, 0, GFP_NOWAIT);
> > +	ret = xa_alloc_cyclic(&sriov->pv_id_table, &ent->pv_cm_id, ent,
> > +			xa_limit_32b, &sriov->pv_id_next, GFP_KERNEL);
> 
> Why drop the NO_WAIT? Explain in the commit message?

That's the standard pattern.

idr_preload(GFP_KERNEL);
spin_lock()
idr_alloc(..., GFP_NOWAIT);

becomes just

xa_alloc(..., GFP_KERNEL);



[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