From: Martin Josefsson <gandalf@wlug.westbo.se>
To: Andi Kleen <ak@suse.de>
Cc: jamal <hadi@cyberus.ca>, Rusty Russell <rusty@rustcorp.com.au>,
Netfilter-devel <netfilter-devel@lists.netfilter.org>,
netdev@oss.sgi.com, netfilter-core@lists.netfilter.org
Subject: Re: TODO list before feature freeze
Date: 30 Jul 2002 00:43:52 +0200 [thread overview]
Message-ID: <1027982632.12630.119.camel@tux> (raw)
In-Reply-To: <20020729135615.A20412@wotan.suse.de>
On Mon, 2002-07-29 at 13:56, Andi Kleen wrote:
> here is a patch for 2.4 that just makes it use get_free_pages to test the
> TLB theory. Another obvious improvement would be to not use list_heads
> for the hash table buckets - a single pointer would likely suffice and
> it would cut the hash table in half, saving cache, TLB and memory.
ip_nat_core is also allocating it's hashtable via vmalloc and it's twice
as large as the one in ip_conntrack. (or rather, it's two hashtables
allocated at once, maybe they should be split up into two allocations?)
diff -x *.orig -x *.rej -urN linux-2.4.19-rc3.old/net/ipv4/netfilter/ip_nat_core.c linux-2.4.19-rc3/net/ipv4/netfilter/ip_nat_core.c
--- linux-2.4.19-rc3.old/net/ipv4/netfilter/ip_nat_core.c Thu Jul 25 18:26:42 2002
+++ linux-2.4.19-rc3/net/ipv4/netfilter/ip_nat_core.c Tue Jul 30 00:14:12 2002
@@ -43,6 +43,8 @@
/* Calculated at init based on memory size */
static unsigned int ip_nat_htable_size;
+static int ip_nat_vmalloc;
+
static struct list_head *bysource;
static struct list_head *byipsproto;
LIST_HEAD(protos);
@@ -958,8 +960,16 @@
/* Leave them the same for the moment. */
ip_nat_htable_size = ip_conntrack_htable_size;
- /* One vmalloc for both hash tables */
- bysource = vmalloc(sizeof(struct list_head) * ip_nat_htable_size*2);
+ /* One allocation for both hash tables */
+ ip_nat_vmalloc = 0;
+ bysource = (void *)__get_free_pages(GFP_KERNEL,
+ get_order(sizeof(struct list_head) *
+ ip_nat_htable_size * 2));
+ if (!bysource) {
+ ip_nat_vmalloc = 1;
+ printk("ip_nat: falling back to vmalloc. performance may be degraded.\n");
+ bysource = vmalloc(sizeof(struct list_head) * ip_nat_htable_size * 2);
+ }
if (!bysource) {
return -ENOMEM;
}
@@ -999,5 +1009,10 @@
{
ip_ct_selective_cleanup(&clean_nat, NULL);
ip_conntrack_destroyed = NULL;
- vfree(bysource);
+
+ if (ip_nat_vmalloc)
+ vfree(bysource);
+ else
+ free_pages((unsigned long)bysource,
+ get_order(sizeof(struct list_head) * ip_nat_htable_size * 2));
}
--
/Martin
Never argue with an idiot. They drag you down to their level, then beat
you with experience.
next prev parent reply other threads:[~2002-07-29 22:43 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-18 9:34 TODO list before feature freeze Rusty Russell
2002-07-19 7:39 ` Balazs Scheidler
2002-07-19 17:43 ` Michael Richardson
2002-07-29 10:57 ` jamal
2002-07-29 11:12 ` Andi Kleen
2002-07-29 11:23 ` jamal
2002-07-29 11:56 ` Andi Kleen
2002-07-29 15:40 ` Martin Josefsson
2002-07-29 16:15 ` Patrick Schaaf
2002-07-29 17:12 ` Martin Josefsson
2002-07-29 17:35 ` Nivedita Singhvi
2002-07-29 22:43 ` Martin Josefsson [this message]
2002-07-29 16:26 ` Patrick Schaaf
2002-07-29 16:31 ` Andi Kleen
2002-07-29 16:42 ` Patrick Schaaf
2002-07-29 16:45 ` Patrick Schaaf
2002-07-30 11:58 ` jamal
2002-07-30 12:27 ` Patrick Schaaf
2002-07-30 12:29 ` jamal
2002-07-30 13:06 ` Patrick Schaaf
2002-07-30 13:42 ` jamal
2002-07-30 13:08 ` Martin Josefsson
2002-07-30 15:54 ` Filip Sneppe (Cronos)
2002-07-29 15:25 ` Michael Richardson
2002-07-29 15:52 ` Patrick Schaaf
2002-07-29 20:51 ` Andi Kleen
2002-07-30 7:26 ` Patrick Schaaf
2002-07-29 22:14 ` Rusty Russell
2002-07-30 12:04 ` jamal
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=1027982632.12630.119.camel@tux \
--to=gandalf@wlug.westbo.se \
--cc=ak@suse.de \
--cc=hadi@cyberus.ca \
--cc=netdev@oss.sgi.com \
--cc=netfilter-core@lists.netfilter.org \
--cc=netfilter-devel@lists.netfilter.org \
--cc=rusty@rustcorp.com.au \
/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).