Skip to contentSkip to conversation

kmemleak: add unlikely() optimization to kmemleak_late_init

PATCH In review Davidlohr Bueso 2 participants 3 messages Sep 21, 2010 – Sep 23, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kmemleak: add unlikely() optimization to kmemleak_late_init

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.

---
 mm/kmemleak.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
mm/kmemleak.c +1 -1
index bd9bc21..7e2f260 100644
@@ -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
Signature · 1 line
1.7.0.4
maintainer
#1 lore raw
Quoted 3 lines · Davidlohr Bueso

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.

Signature · 1 line
Catalin
#2 lore raw
Quoted 9 lines · Catalin Marinas
Quoted 3 lines · Davidlohr Bueso

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