Re: [RFC] Simple Slab: A slab allocator with minimal meta information

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 9 Aug 2006 22:44:59 -0700 (PDT)
Christoph Lameter <[email protected]> wrote:

> On Thu, 10 Aug 2006, KAMEZAWA Hiroyuki wrote:
> 
> > Because of inode_init_once, many codes which uses inode uses initilization code.
> > And inode is one of heavy users of slab.
> 
> Probably just code copied from the same location. It has the same name.
> 
for example, ext3's copy of init_once() is
--
static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags)
{
        struct ext3_inode_info *ei = (struct ext3_inode_info *) foo;

        if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
            SLAB_CTOR_CONSTRUCTOR) {
                INIT_LIST_HEAD(&ei->i_orphan);               ---------------(A)
#ifdef CONFIG_EXT3_FS_XATTR
                init_rwsem(&ei->xattr_sem);                  ---------------(B)
#endif
                mutex_init(&ei->truncate_mutex);             ---------------(C)
                inode_init_once(&ei->vfs_inode);
        }
}

--
(A) and (B) and (C) is only for ext3.

NFS's
--
static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags)
{
        struct nfs_inode *nfsi = (struct nfs_inode *) foo;

        if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
            SLAB_CTOR_CONSTRUCTOR) {
                inode_init_once(&nfsi->vfs_inode);
                spin_lock_init(&nfsi->req_lock);
                INIT_LIST_HEAD(&nfsi->dirty);
                INIT_LIST_HEAD(&nfsi->commit);
                INIT_LIST_HEAD(&nfsi->open_files);
                INIT_RADIX_TREE(&nfsi->nfs_page_tree, GFP_ATOMIC);
                atomic_set(&nfsi->data_updates, 0);
                nfsi->ndirty = 0;
                nfsi->ncommit = 0;
                nfsi->npages = 0;
                nfs4_init_once(nfsi);
        }
}
--


Of cource, many of init_once() just call inode_init_once(). But some fs does
something special.

Thanks,
-Kame

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux