[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <49FAB4FC.6040907@cosmosbay.com>
Date: Fri, 01 May 2009 10:38:20 +0200
From: Eric Dumazet <dada1@...mosbay.com>
To: David Miller <davem@...emloft.net>
CC: shemminger@...tta.com, kaber@...sh.net,
netfilter-devel@...r.kernel.org, netdev@...r.kernel.org
Subject: [PATCH] netfilter: use likely() in xt_info_rdlock_bh()
David Miller a écrit :
> From: Linus Torvalds <torvalds@...ux-foundation.org>
> Date: Tue, 28 Apr 2009 09:55:32 -0700 (PDT)
>
>> On Tue, 28 Apr 2009, Linus Torvalds wrote:
>>> Ack.
>>>
>>> It could do with the update from Eric about how non-current CPU writelocks
>>> only require preemp-disable around get_counters() (and then the
>>> local_bh_disable() only around the current-CPU case).
>> Btw, regardless, that's an incremental improvement, and does not negate
>> the "Ack" part.
>
> I've applied this, thanks everyone!
Small followup on this one, since the likely() were forgotten.
(I trimmed down CCed list, which was insane)
It makes a difference on my x86_32 machine, gcc-4.4.0
Thank you
[PATCH] netfilter: use likely() in xt_info_rdlock_bh()
Signed-off-by: Eric Dumazet <dada1@...mosbay.com>
---
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index 1b2e435..c9efe03 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -472,7 +472,7 @@ static inline void xt_info_rdlock_bh(void)
local_bh_disable();
lock = &__get_cpu_var(xt_info_locks);
- if (!lock->readers++)
+ if (likely(!lock->readers++))
spin_lock(&lock->lock);
}
@@ -480,7 +480,7 @@ static inline void xt_info_rdunlock_bh(void)
{
struct xt_info_lock *lock = &__get_cpu_var(xt_info_locks);
- if (!--lock->readers)
+ if (likely(!--lock->readers))
spin_unlock(&lock->lock);
local_bh_enable();
}
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists