• Christoph Hellwig's avatar
    [PATCH] implement kmem_cache_size() · e0126e64
    Christoph Hellwig authored
    Currently there is no way to find out the effective object size of a slab
    cache.  XFS has lots of IRIX-derived code that want to do zalloc() style
    allocations on zones (which are implemented as slab caches in XFS/Linux)
    and thus needs to know about it.  There are three ways do implement it:
    
    a) implement kmem_cache_zalloc
    b) make the xfs zone a struct of kmem_cache_t and a size variable
    c) implement kmem_cache_size
    
    The current XFS tree does a) but I absolutely don't like it as encourages
    people to use kmem_cache_zalloc for new code instead of thinking about how
    to utilize slab object reuse.  b) would be easy, but I guess kmem_cache_size
    is usefull enough to get into the kernel.  Here's the patch:
    e0126e64
slab.c 52.7 KB