Re: [PATCH v2 for-next] RDMA/hns: Create QP with selected QPN for bank load balance

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

 



On 2020/11/24 0:17, Jason Gunthorpe wrote:
> On Mon, Nov 23, 2020 at 09:06:48PM +0800, Weihang Li wrote:
>> +static int alloc_qpn_with_bankid(struct hns_roce_bank *bank, u8 bankid,
>> +				 unsigned long *qpn)
>> +{
>> +	int id;
>> +
>> +	id = ida_alloc_range(&bank->ida, bank->min, bank->max, GFP_KERNEL);
>> +	if (id < 0) {
>> +		id = ida_alloc_range(&bank->ida, bank->rsv_bot, bank->min,
>> +				     GFP_KERNEL);
> 
> Shouldn't this one be bank->max not min? That is the usual way to write a
> cyclic allocator over this kind of API. See the logic in __xa_alloc_cyclic()
> 
> Jason
> 

Thanks for your advice, it's clearer to use bank->max here. We will refer to
how __xa_alloc_cyclic() is implemented.

Weihang



[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