[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080827082650.GF4784@hawkmoon.kerlabs.com>
Date: Wed, 27 Aug 2008 10:26:50 +0200
From: Louis Rilling <Louis.Rilling@...labs.com>
To: Dave Hansen <dave@...ux.vnet.ibm.com>
Cc: containers@...ts.linux-foundation.org, jeremy@...p.org,
arnd@...db.de, linux-kernel@...r.kernel.org,
Oren Laadan <orenl@...columbia.edu>
Subject: Re: [RFC v2][PATCH 7/9] Infrastructure for shared objects
On Tue, Aug 26, 2008 at 10:01:04AM -0700, Dave Hansen wrote:
> On Thu, 2008-08-21 at 12:40 +0200, Louis Rilling wrote:
> >
> > > +struct cr_objhash {
> > > + struct cr_obj **hash;
> > > + int next_tag;
> > > +};
> > > +
> > > +#define CR_OBJHASH_NBITS 10 /* 10 bits = 1K buckets */
> > > +#define CR_OBJHASH_ORDER 0 /* 1K buckets * 4 bytes/bucket = 1
> > page */
> >
> > Only true when PAGE_SIZE == 4K and in 32bits. Perhaps like below?
> >
> > #define CR_OBJHASH_BUCKET_NBITS (BITS_PER_LONG == 64 ? 3 : 2)
> > #define CR_MIN_OBJHASH_NBITS ((PAGE_SHIFT - CR_OBJHASH_BUCKET_NBITS)
> > #define CR_OBJHASH_NBITS (CR_MIN_OBJHASH_NBITS >= 10 ?
> > CR_MIN_OBJHASH_NBITS : 10)
> > #define CR_OBJHASH_ORDER (CR_OBJHASH_NBITS + CR_OBJHASH_BUCKET_NBITS -
> > PAGE_SHIFT)
>
> Gah. Can't we just use the existing radix tree or hash implementations
> we already have?
AFAICS, all hash implementations work like this (I'm referring to pid hashes
and compat_ioctl hashes for instance). The only common code is the hash
functions, which Oren seems to have used.
Radix trees may be an alternative, given that object tags are sequentially
generated in some way. I have no idea about the simplicity we can gain though.
Louis
--
Dr Louis Rilling Kerlabs
Skype: louis.rilling Batiment Germanium
Phone: (+33|0) 6 80 89 08 23 80 avenue des Buttes de Coesmes
http://www.kerlabs.com/ 35700 Rennes
Download attachment "signature.asc" of type "application/pgp-signature" (190 bytes)
Powered by blists - more mailing lists