Re: [patch 20/23] dentries: Add constructor

Christoph Lameter
2007-11-08T19:03:42Z

On Thu, 8 Nov 2007, Mel Gorman wrote:

> > Signed-off-by: Christoph Lameter <clameter@sgi.com>
>
> Seems to be some garbling on there in the signed-off lines.

Yes that needs to be fixed.

> > +void dcache_ctor(struct kmem_cache *s, void *p)
> > +{
> > + struct dentry *dentry = p;
> > +
> > + spin_lock_init(&dentry->d_lock);
> > + dentry->d_inode = NULL;
> > + INIT_LIST_HEAD(&dentry->d_lru);
> > + INIT_LIST_HEAD(&dentry->d_alias);
> > +}
> > +
>
> Is there any noticable overhead to the constructor?

Its a minor performance win since we can avoid reinitializing these
values and zeroing the object on alloc if there are already allocated
objects.