Commit:     80cbd911ca25535f6bb66bbcbb98950ec328eb40
Parent:     e1cca7e8d484390169777b423a7fe46c7021fec1
Author:     Matthew Wilcox <[EMAIL PROTECTED]>
AuthorDate: Thu Nov 29 12:05:13 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Fri Nov 30 08:08:05 2007 -0800

    Fix kmem_cache_free performance regression in slab
    The database performance group have found that half the cycles spent
    in kmem_cache_free are spent in this one call to BUG_ON.  Moving it
    into the CONFIG_SLAB_DEBUG-only function cache_free_debugcheck() is a
    performance win of almost 0.5% on their particular benchmark.
    The call was added as part of commit 
    with the comment that "overhead should be minimal".  It may have been
    minimal at the time, but it isn't now.
    [ Quoth Pekka Enberg: "I don't think the BUG_ON per se caused the
      performance regression but rather the virt_to_head_page() changes to
      virt_to_cache() that were added later." ]
    Signed-off-by: Matthew Wilcox <[EMAIL PROTECTED]>
    Acked-by: Pekka J Enberg <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
 mm/slab.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/slab.c b/mm/slab.c
index c31cd36..202465a 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2881,6 +2881,8 @@ static void *cache_free_debugcheck(struct kmem_cache 
*cachep, void *objp,
        unsigned int objnr;
        struct slab *slabp;
+       BUG_ON(virt_to_cache(objp) != cachep);
        objp -= obj_offset(cachep);
        page = virt_to_head_page(objp);
@@ -3759,8 +3761,6 @@ void kmem_cache_free(struct kmem_cache *cachep, void 
        unsigned long flags;
-       BUG_ON(virt_to_cache(objp) != cachep);
        debug_check_no_locks_freed(objp, obj_size(cachep));
        __cache_free(cachep, objp);
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

Reply via email to