All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH 0/10]: ct_extend
@ 2007-06-25  3:14 Yasuyuki KOZAKAI
  2007-06-25 10:16 ` Patrick McHardy
  0 siblings, 1 reply; 4+ messages in thread
From: Yasuyuki KOZAKAI @ 2007-06-25  3:14 UTC (permalink / raw)
  To: netfilter-devel; +Cc: rusty, kaber, pablo, kadlec


Hi,

This patch set is a snapshot of the ct_extend, which shrinks memory
usage where extensions such as NAT and helper are not used.

I've applied all suggestions from Patrick. If nat module is loaded,
ct_extend pre-allocates extended area of NAT when it initially allocates
extended area of helper. I've also renamed functions to nf_ct_ext_* and
merged the members in 'struct nf_nat_info' into 'struct nf_conn_nat'.

-- Yasuyuki Kozakai

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

* Re: [RFC][PATCH 0/10]: ct_extend
  2007-06-25  3:14 [RFC][PATCH 0/10]: ct_extend Yasuyuki KOZAKAI
@ 2007-06-25 10:16 ` Patrick McHardy
  2007-06-25 16:49   ` Yasuyuki KOZAKAI
       [not found]   ` <200706251649.l5PGn3eL021623@toshiba.co.jp>
  0 siblings, 2 replies; 4+ messages in thread
From: Patrick McHardy @ 2007-06-25 10:16 UTC (permalink / raw)
  To: Yasuyuki KOZAKAI; +Cc: rusty, netfilter-devel, pablo, kadlec

Yasuyuki KOZAKAI wrote:
> Hi,
> 
> This patch set is a snapshot of the ct_extend, which shrinks memory
> usage where extensions such as NAT and helper are not used.
> 
> I've applied all suggestions from Patrick. If nat module is loaded,
> ct_extend pre-allocates extended area of NAT when it initially allocates
> extended area of helper. I've also renamed functions to nf_ct_ext_* and
> merged the members in 'struct nf_nat_info' into 'struct nf_conn_nat'.


The patches look pretty good to me. For normal conntracks without
NAT or helpers its a clear win since we avoid the double search of
expectations. The only case I'm a bit worried about is NAT, for that
case we get an extra allocation for every new connection. But I
guess thats better than what we have now, the double search reportedly
costs about 10% performance for all cases.

Do you think we should put these patches in 2.6.23?

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

* Re: [RFC][PATCH 0/10]: ct_extend
  2007-06-25 10:16 ` Patrick McHardy
@ 2007-06-25 16:49   ` Yasuyuki KOZAKAI
       [not found]   ` <200706251649.l5PGn3eL021623@toshiba.co.jp>
  1 sibling, 0 replies; 4+ messages in thread
From: Yasuyuki KOZAKAI @ 2007-06-25 16:49 UTC (permalink / raw)
  To: kaber; +Cc: rusty, netfilter-devel, pablo, yasuyuki.kozakai, kadlec

From: Patrick McHardy <kaber@trash.net>
Date: Mon, 25 Jun 2007 12:16:35 +0200

> Yasuyuki KOZAKAI wrote:
> > Hi,
> > 
> > This patch set is a snapshot of the ct_extend, which shrinks memory
> > usage where extensions such as NAT and helper are not used.
> > 
> > I've applied all suggestions from Patrick. If nat module is loaded,
> > ct_extend pre-allocates extended area of NAT when it initially allocates
> > extended area of helper. I've also renamed functions to nf_ct_ext_* and
> > merged the members in 'struct nf_nat_info' into 'struct nf_conn_nat'.
> 
> 
> The patches look pretty good to me. For normal conntracks without
> NAT or helpers its a clear win since we avoid the double search of
> expectations. The only case I'm a bit worried about is NAT, for that
> case we get an extra allocation for every new connection. But I
> guess thats better than what we have now, the double search reportedly
> costs about 10% performance for all cases.
> 
> Do you think we should put these patches in 2.6.23?

I think it's ready.

I've re-checked race at nf_conntrack_netlink and I think there is no
race on members in nfct_nat(ct) at ct_netlink_change_helper(). Because

- 'bysource' and 'ct' are protected by nf_nat_lock when the area of
  nfct_nat(ct) is reallocated.
- 'seq' and 'help' are used by only helper, but we don't change helper.
  So there is no race.
- 'masq_index' is set in ipt_MASQUERADE.c while conntrack is
  unconfirmed. Besides nfctnetlink can change only confirmed conntracks.
  And 'masq_index' in confirmed conntrack is never changed.

BTW, I don't understand why ipt_MQASQUERADE needs lock. I think there is no
difference of results if we remove the lock. If we want to completely
discards conntracks related to output device, MASQUERADE should wait
in *_event() until all packets pass through network stack. But I'm not sure
it's possible.


Anyway, I'll resend updated patches.

-- Yasuyuki Kozakai

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

* Re: [RFC][PATCH 0/10]: ct_extend
       [not found]   ` <200706251649.l5PGn3eL021623@toshiba.co.jp>
@ 2007-06-25 18:05     ` Patrick McHardy
  0 siblings, 0 replies; 4+ messages in thread
From: Patrick McHardy @ 2007-06-25 18:05 UTC (permalink / raw)
  To: Yasuyuki KOZAKAI; +Cc: rusty, netfilter-devel, pablo, kadlec

Yasuyuki KOZAKAI wrote:
> From: Patrick McHardy <kaber@trash.net>
> Date: Mon, 25 Jun 2007 12:16:35 +0200
> 
>>Do you think we should put these patches in 2.6.23?
> 
> 
> I think it's ready.

Great.

> I've re-checked race at nf_conntrack_netlink and I think there is no
> race on members in nfct_nat(ct) at ct_netlink_change_helper(). Because
> 
> - 'bysource' and 'ct' are protected by nf_nat_lock when the area of
>   nfct_nat(ct) is reallocated.
> - 'seq' and 'help' are used by only helper, but we don't change helper.
>   So there is no race.
> - 'masq_index' is set in ipt_MASQUERADE.c while conntrack is
>   unconfirmed. Besides nfctnetlink can change only confirmed conntracks.
>   And 'masq_index' in confirmed conntrack is never changed.

Sounds right.

> BTW, I don't understand why ipt_MQASQUERADE needs lock. I think there is no
> difference of results if we remove the lock. If we want to completely
> discards conntracks related to output device, MASQUERADE should wait
> in *_event() until all packets pass through network stack. But I'm not sure
> it's possible.


Yes it looks unnecessary. Reliably removing all conntracks is not
really necessary, its only an optimization to keep the table smaller.

I'm actually happy about every missed connection since my DSL line
has an almost permanent address and connections usually live on
after a reconnect unless NAT remaps them :)

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

end of thread, other threads:[~2007-06-25 18:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-25  3:14 [RFC][PATCH 0/10]: ct_extend Yasuyuki KOZAKAI
2007-06-25 10:16 ` Patrick McHardy
2007-06-25 16:49   ` Yasuyuki KOZAKAI
     [not found]   ` <200706251649.l5PGn3eL021623@toshiba.co.jp>
2007-06-25 18:05     ` 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.