[openib-general] [PATCH v2 4/7] AMSO1100 Memory Management.

Steve Wise swise at opengridcomputing.com
Fri Jun 16 07:20:31 PDT 2006



On Mon, 2006-06-12 at 11:05 -0500, Tom Tucker wrote:
> On Thu, 2006-06-08 at 01:17 -0700, Andrew Morton wrote:
> > On Wed, 07 Jun 2006 15:06:55 -0500
> > Steve Wise <swise at opengridcomputing.com> wrote:
> > 
> > > 
> > > +void c2_free(struct c2_alloc *alloc, u32 obj)
> > > +{
> > > +	spin_lock(&alloc->lock);
> > > +	clear_bit(obj, alloc->table);
> > > +	spin_unlock(&alloc->lock);
> > > +}
> > 
> > The spinlock is unneeded here.
> 
> Good point.
> 
> > 
> > 
> > What does all the code in this file do, anyway?  It looks totally generic
> > (and hence inappropriate for drivers/infiniband/hw/amso1100/) and somewhat
> > similar to idr trees, perhaps.
> > 
> 
> We mimicked the mthca driver. It may be code that should be replaced
> with Linux core services for new drivers. We'll investigate.
> 

The code in this file implements 2 sets of services:  

1) allocating unique qp identifiers (type integer).  This is the
c2_alloc struct and functions.

2) maintaining a sparsely allocated array of ptrs indexed by the qp
identifier.  This allows for quick mapping to the qp structure ptr given
the qp identifier.  This is the c2_array struct and functions.


I believe I can use an IDR tree to provide both of these services.


Steve.







More information about the general mailing list