Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 6882
b: refs/heads/master
c: 00e145b
h: refs/heads/master
v: v3
  • Loading branch information
Manfred Spraul authored and Linus Torvalds committed Sep 5, 2005
1 parent 913bdea commit 7743af3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 34342e863c3143640c031760140d640a06c6a5f8
refs/heads/master: 00e145b6d59a16dd7740197a18f7abdb3af004a9
26 changes: 15 additions & 11 deletions trunk/mm/slab.c
Original file line number Diff line number Diff line change
Expand Up @@ -3076,20 +3076,24 @@ ssize_t slabinfo_write(struct file *file, const char __user *buffer,
}
#endif

/**
* ksize - get the actual amount of memory allocated for a given object
* @objp: Pointer to the object
*
* kmalloc may internally round up allocations and return more memory
* than requested. ksize() can be used to determine the actual amount of
* memory allocated. The caller may use this additional memory, even though
* a smaller amount of memory was initially specified with the kmalloc call.
* The caller must guarantee that objp points to a valid object previously
* allocated with either kmalloc() or kmem_cache_alloc(). The object
* must not be freed during the duration of the call.
*/
unsigned int ksize(const void *objp)
{
kmem_cache_t *c;
unsigned long flags;
unsigned int size = 0;

if (likely(objp != NULL)) {
local_irq_save(flags);
c = GET_PAGE_CACHE(virt_to_page(objp));
size = kmem_cache_size(c);
local_irq_restore(flags);
}
if (unlikely(objp == NULL))
return 0;

return size;
return obj_reallen(GET_PAGE_CACHE(virt_to_page(objp)));
}


Expand Down

0 comments on commit 7743af3

Please sign in to comment.