lkml.org 
[lkml]   [2007]   [Feb]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH 08/29] mm: kmem_cache_objs_to_pages()
    Provide a method to calculate the number of pages needed to store a given
    number of slab objects (upper bound when considering possible partial and
    free slabs).

    Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
    ---
    include/linux/slab.h | 1 +
    mm/slab.c | 6 ++++++
    2 files changed, 7 insertions(+)

    Index: linux-2.6-git/include/linux/slab.h
    ===================================================================
    --- linux-2.6-git.orig/include/linux/slab.h 2007-01-09 11:28:32.000000000 +0100
    +++ linux-2.6-git/include/linux/slab.h 2007-01-09 11:30:16.000000000 +0100
    @@ -43,6 +43,7 @@ typedef struct kmem_cache kmem_cache_t _
    */
    void __init kmem_cache_init(void);
    extern int slab_is_available(void);
    +extern unsigned int kmem_cache_objs_to_pages(struct kmem_cache *, int);

    struct kmem_cache *kmem_cache_create(const char *, size_t, size_t,
    unsigned long,
    Index: linux-2.6-git/mm/slab.c
    ===================================================================
    --- linux-2.6-git.orig/mm/slab.c 2007-01-09 11:30:00.000000000 +0100
    +++ linux-2.6-git/mm/slab.c 2007-01-09 11:30:16.000000000 +0100
    @@ -4482,3 +4482,9 @@ unsigned int ksize(const void *objp)

    return obj_size(virt_to_cache(objp));
    }
    +
    +unsigned int kmem_cache_objs_to_pages(struct kmem_cache *cachep, int nr)
    +{
    + return ((nr + cachep->num - 1) / cachep->num) << cachep->gfporder;
    +}
    +EXPORT_SYMBOL_GPL(kmem_cache_objs_to_pages);
    --

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

    \
     
     \ /
      Last update: 2007-02-21 16:37    [W:0.019 / U:29.924 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site