lkml.org 
[lkml]   [2009]   [Mar]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 2/5] mm: remove unlikly NULL from kfree
From: Steven Rostedt <rostedt@goodmis.org>

Impact: clean up

A NULL pointer to kfree is no longer unlikely, as seen by the
annotated branch profiler:

correct incorrect % Function File Line
------- --------- - -------- ---- ----
728571 1315540 64 kfree slab.c 3719
This makes sense, since we now encourage developers to just call kfree
without checking for NULL.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
mm/slab.c | 2 +-
mm/slob.c | 2 +-
mm/slub.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/mm/slab.c b/mm/slab.c
index 4d00855..0386c33 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -3716,7 +3716,7 @@ void kfree(const void *objp)
struct kmem_cache *c;
unsigned long flags;

- if (unlikely(ZERO_OR_NULL_PTR(objp)))
+ if (ZERO_OR_NULL_PTR(objp))
return;
local_irq_save(flags);
kfree_debugcheck(objp);
diff --git a/mm/slob.c b/mm/slob.c
index 52bc8a2..e077174 100644
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -491,7 +491,7 @@ void kfree(const void *block)
{
struct slob_page *sp;

- if (unlikely(ZERO_OR_NULL_PTR(block)))
+ if (ZERO_OR_NULL_PTR(block))
return;

sp = (struct slob_page *)virt_to_page(block);
diff --git a/mm/slub.c b/mm/slub.c
index 0280eee..65dc436 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2743,7 +2743,7 @@ void kfree(const void *x)
struct page *page;
void *object = (void *)x;

- if (unlikely(ZERO_OR_NULL_PTR(x)))
+ if (ZERO_OR_NULL_PTR(x))
return;

page = virt_to_head_page(x);
--
1.6.2
--


\
 
 \ /
  Last update: 2009-03-25 06:23    [from the cache]
©2003-2011 Jasper Spaans