* [PATCH] netfilter: remove an atomic bit operation
@ 2010-11-20 7:55 Changli Gao
2010-11-20 16:03 ` Tim Gardner
0 siblings, 1 reply; 4+ messages in thread
From: Changli Gao @ 2010-11-20 7:55 UTC (permalink / raw)
To: Patrick McHardy; +Cc: David S. Miller, netfilter-devel, netdev, Changli Gao
As this ct won't be seen by the others, we don't need to set the
IPS_CONFIRMED_BIT in atomic way.
Signed-off-by: Changli Gao <xiaosuo@gmail.com>
---
net/netfilter/nf_conntrack_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 27a5ea6..c708248 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -486,7 +486,7 @@ __nf_conntrack_confirm(struct sk_buff *skb)
ct->timeout.expires += jiffies;
add_timer(&ct->timeout);
atomic_inc(&ct->ct_general.use);
- set_bit(IPS_CONFIRMED_BIT, &ct->status);
+ ct->status |= IPS_CONFIRMED_BIT;
/* Since the lookup is lockless, hash insertion must be done after
* starting the timer and setting the CONFIRMED bit. The RCU barriers
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] netfilter: remove an atomic bit operation
2010-11-20 7:55 [PATCH] netfilter: remove an atomic bit operation Changli Gao
@ 2010-11-20 16:03 ` Tim Gardner
2010-11-20 16:50 ` Eric Dumazet
0 siblings, 1 reply; 4+ messages in thread
From: Tim Gardner @ 2010-11-20 16:03 UTC (permalink / raw)
To: Changli Gao; +Cc: Patrick McHardy, David S. Miller, netfilter-devel, netdev
On 11/20/2010 12:55 AM, Changli Gao wrote:
> As this ct won't be seen by the others, we don't need to set the
> IPS_CONFIRMED_BIT in atomic way.
>
> Signed-off-by: Changli Gao<xiaosuo@gmail.com>
> ---
> net/netfilter/nf_conntrack_core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
> index 27a5ea6..c708248 100644
> --- a/net/netfilter/nf_conntrack_core.c
> +++ b/net/netfilter/nf_conntrack_core.c
> @@ -486,7 +486,7 @@ __nf_conntrack_confirm(struct sk_buff *skb)
> ct->timeout.expires += jiffies;
> add_timer(&ct->timeout);
> atomic_inc(&ct->ct_general.use);
> - set_bit(IPS_CONFIRMED_BIT,&ct->status);
> + ct->status |= IPS_CONFIRMED_BIT;
>
> /* Since the lookup is lockless, hash insertion must be done after
> * starting the timer and setting the CONFIRMED bit. The RCU barriers
> --
> 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
NAK, set_bit() takes a bit number, not a mask. That is, assuming you can
get away with a non-atomic operation on this field. I'll defer to
Patrick on that.
I think you have to use IPS_CONFIRMED instead, e.g.,
ct->status |= IPS_CONFIRMED;
rtg
--
Tim Gardner tim.gardner@canonical.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] netfilter: remove an atomic bit operation
2010-11-20 16:03 ` Tim Gardner
@ 2010-11-20 16:50 ` Eric Dumazet
2010-11-20 23:38 ` Changli Gao
0 siblings, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2010-11-20 16:50 UTC (permalink / raw)
To: tim.gardner
Cc: Changli Gao, Patrick McHardy, David S. Miller, netfilter-devel,
netdev
Le samedi 20 novembre 2010 à 09:03 -0700, Tim Gardner a écrit :
> On 11/20/2010 12:55 AM, Changli Gao wrote:
> > As this ct won't be seen by the others, we don't need to set the
> > IPS_CONFIRMED_BIT in atomic way.
> >
> > Signed-off-by: Changli Gao<xiaosuo@gmail.com>
> > ---
> > net/netfilter/nf_conntrack_core.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> > diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
> > index 27a5ea6..c708248 100644
> > --- a/net/netfilter/nf_conntrack_core.c
> > +++ b/net/netfilter/nf_conntrack_core.c
> > @@ -486,7 +486,7 @@ __nf_conntrack_confirm(struct sk_buff *skb)
> > ct->timeout.expires += jiffies;
> > add_timer(&ct->timeout);
> > atomic_inc(&ct->ct_general.use);
> > - set_bit(IPS_CONFIRMED_BIT,&ct->status);
> > + ct->status |= IPS_CONFIRMED_BIT;
> >
> > /* Since the lookup is lockless, hash insertion must be done after
> > * starting the timer and setting the CONFIRMED bit. The RCU barriers
> > --
> NAK, set_bit() takes a bit number, not a mask. That is, assuming you can
> get away with a non-atomic operation on this field. I'll defer to
> Patrick on that.
>
> I think you have to use IPS_CONFIRMED instead, e.g.,
>
> ct->status |= IPS_CONFIRMED;
>
Or
__set_bit(IPS_CONFIRMED_BIT, &ct->status);
set_bit() is atomic, while __set_bit() is not
--
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] 4+ messages in thread
* Re: [PATCH] netfilter: remove an atomic bit operation
2010-11-20 16:50 ` Eric Dumazet
@ 2010-11-20 23:38 ` Changli Gao
0 siblings, 0 replies; 4+ messages in thread
From: Changli Gao @ 2010-11-20 23:38 UTC (permalink / raw)
To: Eric Dumazet
Cc: tim.gardner, Patrick McHardy, David S. Miller, netfilter-devel,
netdev
On Sun, Nov 21, 2010 at 12:50 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> Le samedi 20 novembre 2010 à 09:03 -0700, Tim Gardner a écrit :
>
>> NAK, set_bit() takes a bit number, not a mask. That is, assuming you can
>> get away with a non-atomic operation on this field. I'll defer to
>> Patrick on that.
>>
>> I think you have to use IPS_CONFIRMED instead, e.g.,
>>
>> ct->status |= IPS_CONFIRMED;
>>
>
> Or
>
> __set_bit(IPS_CONFIRMED_BIT, &ct->status);
>
>
> set_bit() is atomic, while __set_bit() is not
>
Oh, you are right. Thanks. My a previous patch accepted by Patrick has
the same problem.
--
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] 4+ messages in thread
end of thread, other threads:[~2010-11-20 23:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-20 7:55 [PATCH] netfilter: remove an atomic bit operation Changli Gao
2010-11-20 16:03 ` Tim Gardner
2010-11-20 16:50 ` Eric Dumazet
2010-11-20 23:38 ` Changli Gao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).