Commit 671ee841 authored by Christoph Hellwig's avatar Christoph Hellwig

[PATCH] ksize of uClinux

find out the effective size of a kmalloc()ed object, needed by uClinux
but also usefull for the "normal" ports, thus not ifdef'ed.
parent 87f71ebb
......@@ -60,6 +60,7 @@ extern unsigned int kmem_cache_size(kmem_cache_t *);
extern void *kmalloc(size_t, int);
extern void kfree(const void *);
extern unsigned int ksize(const void *);
extern int FASTCALL(kmem_cache_reap(int));
......
......@@ -2285,3 +2285,20 @@ ssize_t slabinfo_write(struct file *file, const char *buffer,
return res;
}
#endif
unsigned int ksize(const void *objp)
{
kmem_cache_t *c;
unsigned long flags;
unsigned int size = 0;
if (likely(objp)) {
local_irq_save(flags);
c = GET_PAGE_CACHE(virt_to_page(objp));
size = kmem_cache_size(c);
local_irq_restore(flags);
}
return size;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment