diff options
| author | Christoph Hellwig <hch@lst.de> | 2002-07-29 01:19:18 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2002-07-29 01:19:18 -0700 |
| commit | e0126e6435c7d0f36e44bee5808397d7cca74627 (patch) | |
| tree | 2ebfd763d19e80a00145e3a956979d644ff6ac7d /include/linux/slab.h | |
| parent | 5ff53a14bff6e28e5ab6858d574e786296355e37 (diff) | |
[PATCH] implement kmem_cache_size()
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:
Diffstat (limited to 'include/linux/slab.h')
| -rw-r--r-- | include/linux/slab.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/slab.h b/include/linux/slab.h index 2722b5a342a8..72b03d90f688 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -57,6 +57,7 @@ extern int kmem_cache_destroy(kmem_cache_t *); extern int kmem_cache_shrink(kmem_cache_t *); extern void *kmem_cache_alloc(kmem_cache_t *, int); extern void kmem_cache_free(kmem_cache_t *, void *); +extern unsigned int kmem_cache_size(kmem_cache_t *); extern void *kmalloc(size_t, int); extern void kfree(const void *); |
