public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kmemleak: add unlikely() optimization to kmemleak_late_init
@ 2010-09-21 17:23 Davidlohr Bueso
  2010-09-22 10:06 ` Catalin Marinas
  0 siblings, 1 reply; 3+ messages in thread
From: Davidlohr Bueso @ 2010-09-21 17:23 UTC (permalink / raw)
  To: catalin.marinas; +Cc: LKML

kmemleak: add unlikely() optimization to kmemleak_late_init()

Since there it is not very probable that kmemleak_disable() was called right after setting kmemleak_initialized, we could benefit from predicting it.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
---
 mm/kmemleak.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index bd9bc21..7e2f260 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -1728,7 +1728,7 @@ static int __init kmemleak_late_init(void)
 
 	atomic_set(&kmemleak_initialized, 1);
 
-	if (atomic_read(&kmemleak_error)) {
+	if (unlikely(atomic_read(&kmemleak_error))) {
 		/*
 		 * Some error occured and kmemleak was disabled. There is a
 		 * small chance that kmemleak_disable() was called immediately
-- 
1.7.0.4




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] kmemleak: add unlikely() optimization to kmemleak_late_init
  2010-09-21 17:23 [PATCH] kmemleak: add unlikely() optimization to kmemleak_late_init Davidlohr Bueso
@ 2010-09-22 10:06 ` Catalin Marinas
  2010-09-23 14:05   ` Davidlohr Bueso
  0 siblings, 1 reply; 3+ messages in thread
From: Catalin Marinas @ 2010-09-22 10:06 UTC (permalink / raw)
  To: dave; +Cc: LKML

Davidlohr Bueso <dave@gnu.org> wrote:
> kmemleak: add unlikely() optimization to kmemleak_late_init()
>
> Since there it is not very probable that kmemleak_disable() was called right after setting kmemleak_initialized, we could benefit from predicting it.

The patch is correct and you can add my Acked-by but I don't really
think it's worth. We save ~2 cycles during booting, no-one would ever
notice.

-- 
Catalin

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] kmemleak: add unlikely() optimization to kmemleak_late_init
  2010-09-22 10:06 ` Catalin Marinas
@ 2010-09-23 14:05   ` Davidlohr Bueso
  0 siblings, 0 replies; 3+ messages in thread
From: Davidlohr Bueso @ 2010-09-23 14:05 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: LKML

On Wed, 2010-09-22 at 11:06 +0100, Catalin Marinas wrote:
> Davidlohr Bueso <dave@gnu.org> wrote:
> > kmemleak: add unlikely() optimization to kmemleak_late_init()
> >
> > Since there it is not very probable that kmemleak_disable() was called right after setting kmemleak_initialized, we could benefit from predicting it.
> 
> The patch is correct and you can add my Acked-by but I don't really
> think it's worth. We save ~2 cycles during booting, no-one would ever
> notice.
> 

Yeah, it's not a big performance booster, but IMHO it wouldn't hurt to
add it. Since you are the maintainer it's up to you if you include it
upstream.

Thanks,
Davidlohr


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-09-23 14:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-21 17:23 [PATCH] kmemleak: add unlikely() optimization to kmemleak_late_init Davidlohr Bueso
2010-09-22 10:06 ` Catalin Marinas
2010-09-23 14:05   ` Davidlohr Bueso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox