Re: [PATCH 08/40] mm: kmem_cache_objsize

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

 



On 5/4/07, Peter Zijlstra <[email protected]> wrote:
Expost buffer_size in order to allow fair estimates on the actual space
used/needed.

[snip]

 #ifdef CONFIG_SLAB_FAIR
-static inline int slab_alloc_rank(gfp_t flags)
+static __always_inline int slab_alloc_rank(gfp_t flags)
 {
        return gfp_to_rank(flags);
 }
 #else
-static inline int slab_alloc_rank(gfp_t flags)
+static __always_inline int slab_alloc_rank(gfp_t flags)
 {
        return 0;
 }

Me thinks this hunk doesn't belong in this patch.

@@ -3815,6 +3815,12 @@ unsigned int kmem_cache_size(struct kmem
 }
 EXPORT_SYMBOL(kmem_cache_size);

+unsigned int kmem_cache_objsize(struct kmem_cache *cachep)
+{
+       return cachep->buffer_size;
+}
+EXPORT_SYMBOL_GPL(kmem_cache_objsize);
+
 const char *kmem_cache_name(struct kmem_cache *cachep)
 {
        return cachep->name;
@@ -4512,3 +4518,9 @@ unsigned int ksize(const void *objp)

        return obj_size(virt_to_cache(objp));
 }
+
+unsigned int kobjsize(size_t size)
+{
+       return kmem_cache_objsize(kmem_find_general_cachep(size, 0));
+}
+EXPORT_SYMBOL_GPL(kobjsize);

Looks good to me. Unfortunately, you need to do SLUB as well. Aah, the
wonders of three kernel memory allocators... ;-)

                                    Pekka
-
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