Re: [PATCH v2 4/7] AMSO1100 Memory Management.
From: Steve Wise
Date: Fri Jun 16 2006 - 10:19:22 EST
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@xxxxxxxxxxxxxxxxxxxxx> 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.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/