Re: [PATCH rdma-next 15/16] RDMA/restrack: Implement software ID interface

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

 



On Tue, Jan 15, 2019 at 12:56:10PM +0200, Leon Romanovsky wrote:
> > > -	ret = xa_insert(xa, res_to_id(res), res, GFP_KERNEL);
> > > -	WARN_ONCE(ret == -EEXIST, "Tried to add non-unique type %d entry\n",
> > > -		  res->type);
> > > +	if (rt[res->type].max) {
> > > +		/* Not HW-capable device */
> > > +		res->id = rt[res->type].reserved;
> > > +		ret = xa_alloc(xa, &res->id, rt[res->type].max, res,
> > > +			       GFP_KERNEL);
> >
> > I feel like the SW ids should by allocated cyclicly?
> 
> It was my initial thought too, but after I saw that most of the drivers
> are using find_first_bit()/find_first_zero_bit() in various bitmap,
> I realized that adding complexity for cycling allocation doesn't worth it.

Those drivers didn't contemplate exposing these numbers of net link to
an agent that isn't part of the create/destroy cycle.

Using cyclic is the best way to avoid various races and confusion for
the netlink side, and it is straightforward to do.

Jason



[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