public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Roland McGrath <roland@redhat.com>,
	Nick Piggin <nickpiggin@yahoo.com.au>,
	Steven Rostedt <srostedt@redhat.com>
Subject: [PATCH 2/5] mm: remove unlikly NULL from kfree
Date: Wed, 25 Mar 2009 01:19:22 -0400	[thread overview]
Message-ID: <20090325052023.071564146@goodmis.org> (raw)
In-Reply-To: 20090325051920.406564281@goodmis.org

[-- Attachment #1: 0002-mm-remove-unlikly-NULL-from-kfree.patch --]
[-- Type: text/plain, Size: 1614 bytes --]

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

-- 

  parent reply	other threads:[~2009-03-25  5:20 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-25  5:19 [PATCH 0/5] [PATCH][GIT PULL] remove unnecessary (un)likelys Steven Rostedt
2009-03-25  5:19 ` [PATCH 1/5] ptrace: remove incorrect unlikelys Steven Rostedt
2009-03-25  7:21   ` Ingo Molnar
2009-03-25 13:31     ` Christian Borntraeger
2009-03-25 13:42     ` Steven Rostedt
2009-03-25  9:28   ` Roland McGrath
2009-03-25  5:19 ` Steven Rostedt [this message]
2009-03-25  7:34   ` [PATCH 2/5] mm: remove unlikly NULL from kfree Pekka Enberg
2009-03-25  7:50     ` Thomas Gleixner
2009-03-25  8:01       ` Pekka Enberg
2009-03-25 21:20       ` Andrew Morton
2009-03-25  8:02     ` Hua Zhong
2009-03-25  8:06       ` Pekka Enberg
2009-03-25 13:51         ` Pekka Enberg
2009-03-25 14:47           ` Steven Rostedt
2009-03-25 14:59             ` Pekka Enberg
2009-03-25 15:04               ` Steven Rostedt
2009-03-25 15:08                 ` Steven Rostedt
2009-03-25 16:14                   ` Matt Mackall
2009-03-25 16:34                     ` Steven Rostedt
2009-03-25 20:26                       ` Jeremy Fitzhardinge
2009-03-25 21:09                         ` Matt Mackall
2009-03-25 21:01                       ` Matt Mackall
2009-03-25 21:24                         ` Steven Rostedt
2009-03-25 15:27             ` Steven Rostedt
2009-03-26 16:10           ` Al Viro
2009-03-26 16:15             ` Andrew Morton
2009-03-25  5:19 ` [PATCH 3/5] sched: remove unlikely in pre_schedule_rt Steven Rostedt
2009-03-25  5:24   ` Steven Rostedt
2009-03-25  5:19 ` [PATCH 4/5] sched: remove unlikelys from sched_move_task Steven Rostedt
2009-03-25  5:19 ` [PATCH 5/5] mm: remove unlikelys for unlock in rmap.c Steven Rostedt
2009-04-24 11:12   ` KOSAKI Motohiro
2009-04-24 12:15     ` Lee Schermerhorn
2009-03-25  7:19 ` [PATCH 0/5] [PATCH][GIT PULL] remove unnecessary (un)likelys Ingo Molnar
2009-03-25  7:25 ` Ingo Molnar
2009-03-25 13:43   ` Steven Rostedt
2009-04-27 16:30 ` Daniel Walker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090325052023.071564146@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=nickpiggin@yahoo.com.au \
    --cc=peterz@infradead.org \
    --cc=roland@redhat.com \
    --cc=srostedt@redhat.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox