diff options
author | Satyam Sharma <satyam@infradead.org> | 2007-10-16 10:24:44 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 18:42:53 +0200 |
commit | 2408c55037c3f7d51a8a100025c47595e71b838c (patch) | |
tree | 71940f72dbadf6a6744ffbd062ef4fd8754aa623 /mm/slob.c | |
parent | move mm_struct and vm_area_struct (diff) | |
download | linux-2408c55037c3f7d51a8a100025c47595e71b838c.tar.xz linux-2408c55037c3f7d51a8a100025c47595e71b838c.zip |
{slub, slob}: use unlikely() for kfree(ZERO_OR_NULL_PTR) check
Considering kfree(NULL) would normally occur only in error paths and
kfree(ZERO_SIZE_PTR) is uncommon as well, so let's use unlikely() for the
condition check in SLUB's and SLOB's kfree() to optimize for the common
case. SLAB has this already.
Signed-off-by: Satyam Sharma <satyam@infradead.org>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/slob.c')
-rw-r--r-- | mm/slob.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/mm/slob.c b/mm/slob.c index ec33fcdc852e..a886e83e17ef 100644 --- a/mm/slob.c +++ b/mm/slob.c @@ -360,7 +360,7 @@ static void slob_free(void *block, int size) slobidx_t units; unsigned long flags; - if (ZERO_OR_NULL_PTR(block)) + if (unlikely(ZERO_OR_NULL_PTR(block))) return; BUG_ON(!size); @@ -466,7 +466,7 @@ void kfree(const void *block) { struct slob_page *sp; - if (ZERO_OR_NULL_PTR(block)) + if (unlikely(ZERO_OR_NULL_PTR(block))) return; sp = (struct slob_page *)virt_to_page(block); @@ -484,7 +484,7 @@ size_t ksize(const void *block) { struct slob_page *sp; - if (ZERO_OR_NULL_PTR(block)) + if (unlikely(ZERO_OR_NULL_PTR(block))) return 0; sp = (struct slob_page *)virt_to_page(block); |