[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1282758634.2487.576.camel@edumazet-laptop>
Date: Wed, 25 Aug 2010 19:50:34 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: Anton Blanchard <anton@...ba.org>
Cc: netdev@...r.kernel.org, miltonm@....com
Subject: Re: [PATCH] tcp: Fix sysctl_tcp_max_orphans when PAGE_SIZE != 4k
Le mercredi 25 août 2010 à 17:17 +1000, Anton Blanchard a écrit :
> We were hard coding 4096 when sizing sysctl_tcp_max_orphans which
> causes problems when PAGE_SIZE is not 4k. We calculate an order based on
> PAGE_SHIFT so the count should be based on PAGE_SIZE
>
> Signed-off-By: Milton Miller <miltonm@....com>
> Signed-off-by: Anton Blanchard <anton@...ba.org>
> ---
>
> Index: powerpc.git/net/ipv4/tcp.c
> ===================================================================
> --- powerpc.git.orig/net/ipv4/tcp.c 2010-08-25 17:04:51.190305401 +1000
> +++ powerpc.git/net/ipv4/tcp.c 2010-08-25 17:05:15.463884764 +1000
> @@ -3270,7 +3270,7 @@ void __init tcp_init(void)
> ;
> if (order >= 4) {
> tcp_death_row.sysctl_max_tw_buckets = 180000;
> - sysctl_tcp_max_orphans = 4096 << (order - 4);
> + sysctl_tcp_max_orphans = PAGE_SIZE << (order - 4);
> sysctl_max_syn_backlog = 1024;
> } else if (order < 3) {
> tcp_death_row.sysctl_max_tw_buckets >>= (3 - order);
> --
In fact, existing code makes litle sense....
(tcp_hashinfo.bhash_size * sizeof(struct inet_bind_hashbucket))
is much bigger if spinlock debugging is on. Its strange to select bigger
limits in this case (where kernel structures are also bigger)
bhash_size max is 65536, and we get this value even for small machines.
Sizing would probably be better if using ehash_size instead of
bhash_size
Maybe remove the 'order' loop and use ehash_size, already a result of
the available memory or thash_entries tunable.
unsigned int ehash_size = tcp_hashinfo.ehash_mask + 1;
tcp_death_row.sysctl_max_tw_buckets = cnt / 2;
sysctl_tcp_max_orphans = cnt / 2;
sysctl_max_syn_backlog = min(128, cnt / 256);
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists