From: Patrick McHardy <kaber@trash.net>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: davem@davemloft.net, jonathan@jonmasters.org,
eric.dumazet@gmail.com, netdev@vger.kernel.org,
netfilter-devel@vger.kernel.org
Subject: Re: [PATCH for 2.6.33] conntrack: restrict runtime hashsize modifications
Date: Fri, 05 Feb 2010 11:00:03 +0100 [thread overview]
Message-ID: <4B6BEC23.8020101@trash.net> (raw)
In-Reply-To: <20100204194744.GA4185@x200>
Alexey Dobriyan wrote:
> On Thu, Feb 04, 2010 at 06:04:34PM +0100, Patrick McHardy wrote:
>> Patrick McHardy wrote:
>>> Alexey Dobriyan wrote:
>>>> Jon Masters correctly points out that conntrack hash sizes
>>>> (nf_conntrack_htable_size) are global (not per-netns) and
>>>> modifiable at runtime via /sys/module/nf_conntrack/hashsize .
>>>>
>>>> Steps to reproduce:
>>>> clone(CLONE_NEWNET)
>>>> [grow /sys/module/nf_conntrack/hashsize]
>>>> exit()
>>>>
>>>> At netns exit we are going to scan random memory for conntracks to be killed.
>>>>
>>>> Apparently there is a code which deals with hashtable resize for
>>>> init_net (and it was there befode netns conntrack code), so prohibit
>>>> hashsize modification if there is more than one netns exists.
>>>>
>>>> To change hashtable sizes, you need to reload module.
>>>>
>>>> Expectation hashtable size was simply glued to a variable with no code
>>>> to rehash expectations, so it was a bug to allow writing to it.
>>>> Make "expect_hashsize" readonly.
>>>>
>>>> This is temporarily until we figure out what to do.
>>> How about alternatively moving nf_conntrack_hsize into the
>>> per-namespace struct? It doesn't look more complicated or
>>> intrusive and would allow to still change the init_net
>>> hashsize. Also seems less hackish :)
>> How about this (so far untested) patch? The htable_size is moved into
>> the per-namespace struct and initialized from the current (global)
>> value of nf_conntrack_htable_size. Changes through sysfs are still
>> permitted, but only affect the init namespace and newly created ones.
>
> No matter what we do, it's a hack!
>
>> Additionally I removed reinitializing the hash random value when
>> changing the hash size since that also requires to rehash in all
>> namespaces.
>
> I'm not fond of this, because we're not even closely going to allow changing
> hashtable size per-netns. As such having actual per-netns hashtable size
> just slows down everything.
Actually it doesn't seem like much more work to allow changing
table size, the main problem is that sysfs module parameters
don't seem to fit into the network namespace model at all.
Please be more specific about your suspected slowdowns.
What's "everything"? What's different about the hashsize
compared to the many members we already moved to per-netns
structs?
next prev parent reply other threads:[~2010-02-05 10:00 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-03 20:39 [PATCH for 2.6.33] conntrack: restrict runtime hashsize modifications Alexey Dobriyan
2010-02-03 20:50 ` Jon Masters
2010-02-04 16:18 ` Patrick McHardy
2010-02-04 16:27 ` Patrick McHardy
2010-02-04 20:18 ` Jon Masters
2010-02-05 10:00 ` Patrick McHardy
2010-02-05 10:14 ` Jon Masters
2010-02-05 10:21 ` Patrick McHardy
2010-02-04 17:04 ` Patrick McHardy
2010-02-04 19:47 ` Alexey Dobriyan
2010-02-04 20:23 ` Jon Masters
2010-02-05 10:00 ` Patrick McHardy [this message]
2010-02-05 10:11 ` Jon Masters
2010-02-05 10:19 ` Patrick McHardy
2010-02-05 11:16 ` Patrick McHardy
2010-02-05 11:19 ` Alexey Dobriyan
2010-02-05 11:22 ` Patrick McHardy
2010-02-05 11:25 ` Patrick McHardy
2010-02-05 11:51 ` Jon Masters
2010-02-05 11:23 ` Alexey Dobriyan
2010-02-05 22:04 ` Alexey Dobriyan
2010-02-08 13:34 ` Patrick McHardy
2010-02-08 14:35 ` Patrick McHardy
2010-02-04 20:20 ` Jon Masters
2010-02-05 10:03 ` Patrick McHardy
2010-02-05 10:12 ` Jon Masters
2010-02-05 10:21 ` Patrick McHardy
2010-02-04 17:26 ` Patrick McHardy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B6BEC23.8020101@trash.net \
--to=kaber@trash.net \
--cc=adobriyan@gmail.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=jonathan@jonmasters.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).