Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2408c55037c3f7d51a8a100025c47595e71b838c
Commit:     2408c55037c3f7d51a8a100025c47595e71b838c
Parent:     c92ff1bde06f69d59b40f3194016aee51cc5da55
Author:     Satyam Sharma <[EMAIL PROTECTED]>
AuthorDate: Tue Oct 16 01:24:44 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Tue Oct 16 09:42:53 2007 -0700

    {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 <[EMAIL PROTECTED]>
    Cc: Pekka Enberg <[EMAIL PROTECTED]>
    Cc: Christoph Lameter <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 mm/slob.c |    6 +++---
 mm/slub.c |    8 ++++----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/mm/slob.c b/mm/slob.c
index ec33fcd..a886e83 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);
diff --git a/mm/slub.c b/mm/slub.c
index edeb942..b7d3664 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2449,7 +2449,7 @@ size_t ksize(const void *object)
        struct page *page;
        struct kmem_cache *s;
 
-       if (ZERO_OR_NULL_PTR(object))
+       if (unlikely(ZERO_OR_NULL_PTR(object)))
                return 0;
 
        page = get_object_page(object);
@@ -2483,7 +2483,7 @@ void kfree(const void *x)
 {
        struct page *page;
 
-       if (ZERO_OR_NULL_PTR(x))
+       if (unlikely(ZERO_OR_NULL_PTR(x)))
                return;
 
        page = virt_to_head_page(x);
@@ -2800,7 +2800,7 @@ void *__kmalloc_track_caller(size_t size, gfp_t gfpflags, 
void *caller)
                                                        get_order(size));
        s = get_slab(size, gfpflags);
 
-       if (ZERO_OR_NULL_PTR(s))
+       if (unlikely(ZERO_OR_NULL_PTR(s)))
                return s;
 
        return slab_alloc(s, gfpflags, -1, caller);
@@ -2816,7 +2816,7 @@ void *__kmalloc_node_track_caller(size_t size, gfp_t 
gfpflags,
                                                        get_order(size));
        s = get_slab(size, gfpflags);
 
-       if (ZERO_OR_NULL_PTR(s))
+       if (unlikely(ZERO_OR_NULL_PTR(s)))
                return s;
 
        return slab_alloc(s, gfpflags, node, caller);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to