All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] netfilter: avoid additional compare.
@ 2009-11-03  3:03 Changli Gao
  2009-11-04 12:14 ` Patrick McHardy
  0 siblings, 1 reply; 6+ messages in thread
From: Changli Gao @ 2009-11-03  3:03 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: netfilter-devel, xiaosuo

avoid additional compare.

avoid additional compare.

signed-off-by: Changli Gao <xiaosuo@gmail.com>
----
net/netfilter/nf_conntrack_core.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index ca6e68d..162e8d0 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -512,11 +512,17 @@ static noinline int early_drop(struct net *net, unsigned int hash)
 			cnt++;
 		}
 
-		if (ct && unlikely(nf_ct_is_dying(ct) ||
-				   !atomic_inc_not_zero(&ct->ct_general.use)))
-			ct = NULL;
-		if (ct || cnt >= NF_CT_EVICTION_RANGE)
+		if (ct != NULL) {
+			if (likely(!nf_ct_is_dying(ct) &&
+				   atomic_inc_not_zero(&ct->ct_general.use)))
+				break;
+			else
+				ct = NULL;
+		}
+
+		if (cnt >= NF_CT_EVICITON_RANGE)
 			break;
+
 		hash = (hash + 1) % nf_conntrack_htable_size;
 	}
 	rcu_read_unlock();



^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [PATCH] netfilter: avoid additional compare.
@ 2009-11-05  3:10 Changli Gao
  0 siblings, 0 replies; 6+ messages in thread
From: Changli Gao @ 2009-11-05  3:10 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: netfilter-devel, xiaosuo

avoid additional compare.

avoid additional compare.

signed-off-by: Changli Gao <xiaosuo@gmail.com>
----

diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index ca6e68d..b917d6a 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -512,11 +512,17 @@ static noinline int early_drop(struct net *net, unsigned int hash)
 			cnt++;
 		}
 
-		if (ct && unlikely(nf_ct_is_dying(ct) ||
-				   !atomic_inc_not_zero(&ct->ct_general.use)))
-			ct = NULL;
-		if (ct || cnt >= NF_CT_EVICTION_RANGE)
+		if (ct != NULL) {
+			if (likely(!nf_ct_is_dying(ct) &&
+				   atomic_inc_not_zero(&ct->ct_general.use)))
+				break;
+			else
+				ct = NULL;
+		}
+
+		if (cnt >= NF_CT_EVICTION_RANGE)
 			break;
+
 		hash = (hash + 1) % nf_conntrack_htable_size;
 	}
 	rcu_read_unlock();



^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [PATCH] netfilter: avoid additional compare.
@ 2009-11-05  3:19 Changli Gao
  2009-11-05 13:52 ` Patrick McHardy
  0 siblings, 1 reply; 6+ messages in thread
From: Changli Gao @ 2009-11-05  3:19 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: netfilter-devel, xiaosuo

avoid additional compare.

avoid additional compare.

signed-off-by: Changli Gao <xiaosuo@gmail.com>
----
 net/netfilter/nf_conntrack_core.c |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index ca6e68d..b917d6a 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -512,11 +512,17 @@ static noinline int early_drop(struct net *net, unsigned int hash)
 			cnt++;
 		}
 
-		if (ct && unlikely(nf_ct_is_dying(ct) ||
-				   !atomic_inc_not_zero(&ct->ct_general.use)))
-			ct = NULL;
-		if (ct || cnt >= NF_CT_EVICTION_RANGE)
+		if (ct != NULL) {
+			if (likely(!nf_ct_is_dying(ct) &&
+				   atomic_inc_not_zero(&ct->ct_general.use)))
+				break;
+			else
+				ct = NULL;
+		}
+
+		if (cnt >= NF_CT_EVICTION_RANGE)
 			break;
+
 		hash = (hash + 1) % nf_conntrack_htable_size;
 	}
 	rcu_read_unlock();


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

end of thread, other threads:[~2009-11-05 13:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-03  3:03 [PATCH] netfilter: avoid additional compare Changli Gao
2009-11-04 12:14 ` Patrick McHardy
2009-11-04 13:27   ` Changli Gao
  -- strict thread matches above, loose matches on Subject: below --
2009-11-05  3:10 Changli Gao
2009-11-05  3:19 Changli Gao
2009-11-05 13:52 ` Patrick McHardy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.