* [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
* Re: [PATCH] netfilter: avoid additional compare.
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
0 siblings, 1 reply; 6+ messages in thread
From: Patrick McHardy @ 2009-11-04 12:14 UTC (permalink / raw)
To: xiaosuo; +Cc: netfilter-devel
Changli Gao wrote:
> avoid additional compare.
>
> avoid additional compare.
This doesn't even compile:
net/netfilter/nf_conntrack_core.c: In function 'early_drop':
net/netfilter/nf_conntrack_core.c:522: error: 'NF_CT_EVICITON_RANGE'
undeclared (first use in this function)
Please don't send me untested patches.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] netfilter: avoid additional compare.
2009-11-04 12:14 ` Patrick McHardy
@ 2009-11-04 13:27 ` Changli Gao
0 siblings, 0 replies; 6+ messages in thread
From: Changli Gao @ 2009-11-04 13:27 UTC (permalink / raw)
To: Patrick McHardy; +Cc: netfilter-devel
On Wed, Nov 4, 2009 at 8:14 PM, Patrick McHardy <kaber@trash.net> wrote:
> Changli Gao wrote:
>> avoid additional compare.
>>
>> avoid additional compare.
>
> This doesn't even compile:
>
> net/netfilter/nf_conntrack_core.c: In function 'early_drop':
> net/netfilter/nf_conntrack_core.c:522: error: 'NF_CT_EVICITON_RANGE'
> undeclared (first use in this function)
>
> Please don't send me untested patches.
>
Oh, I am sorry. I sent the wrong version. :( The macro
NF_CT_EVICITON_RANGE should be NF_CT_EVICITION_RANGE.
--
Regards,
Changli Gao(xiaosuo@gmail.com)
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] netfilter: avoid additional compare.
2009-11-05 3:19 Changli Gao
@ 2009-11-05 13:52 ` Patrick McHardy
0 siblings, 0 replies; 6+ messages in thread
From: Patrick McHardy @ 2009-11-05 13:52 UTC (permalink / raw)
To: xiaosuo; +Cc: netfilter-devel
Changli Gao wrote:
> avoid additional compare.
Applied, thanks.
^ permalink raw reply [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
* [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
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
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.