Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 86682
b: refs/heads/master
c: ae20bfd
h: refs/heads/master
v: v3
  • Loading branch information
Christoph Lameter committed Mar 3, 2008
1 parent 1575e85 commit 4df7bc1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 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: 27d9e4e94862c89d171cf70911b4f11ad69fb54e
refs/heads/master: ae20bfda6813387af18c7fdbc0f8b1fa7be2d05b
6 changes: 2 additions & 4 deletions trunk/mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -2610,34 +2610,32 @@ size_t ksize(const void *object)
struct page *page;
struct kmem_cache *s;

BUG_ON(!object);
if (unlikely(object == ZERO_SIZE_PTR))
return 0;

page = virt_to_head_page(object);
BUG_ON(!page);

if (unlikely(!PageSlab(page)))
return PAGE_SIZE << compound_order(page);

s = page->slab;
BUG_ON(!s);

#ifdef CONFIG_SLUB_DEBUG
/*
* Debugging requires use of the padding between object
* and whatever may come after it.
*/
if (s->flags & (SLAB_RED_ZONE | SLAB_POISON))
return s->objsize;

#endif
/*
* If we have the need to store the freelist pointer
* back there or track user information then we can
* only use the space before that information.
*/
if (s->flags & (SLAB_DESTROY_BY_RCU | SLAB_STORE_USER))
return s->inuse;

/*
* Else we can use all the padding etc for the allocation
*/
Expand Down

0 comments on commit 4df7bc1

Please sign in to comment.