[ofa-general] Re: [PATCH for-2.6.22] IB/cm: improve local id allocation

Sean Hefty mshefty at ichips.intel.com
Mon May 21 09:48:37 PDT 2007


> Yes, that's basically what I just proposed (although see below).  It
> all looks pretty safe to me...  Sean, what do you think about this for
> 2.6.22?
> 
>  > diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
>  > index eff591d..5e77b01 100644
>  > --- a/drivers/infiniband/core/cm.c
>  > +++ b/drivers/infiniband/core/cm.c
>  > @@ -306,7 +306,9 @@ static int cm_alloc_id(struct cm_id_private *cm_id_priv)
>  >  	do {
>  >  		spin_lock_irqsave(&cm.lock, flags);
>  >  		ret = idr_get_new_above(&cm.local_id_table, cm_id_priv,
>  > -					next_id++, &id);
>  > +					next_id, &id);
>  > +		if (!ret)
>  > +			next_id = id == 0x7ffffff ? 0 : id + 1;
> 
> ...except I used MAX_INT here, and indeed your patch only has 6 'f's
> in that constant.  Actually digging a little I see that we should use
> MAX_ID_MASK to be really correct.

Looks good.  Thanks

Acked by: Sean Hefty <sean.hefty at intel.com>



More information about the general mailing list