From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757264AbaEFO0q (ORCPT ); Tue, 6 May 2014 10:26:46 -0400 Received: from mail-pd0-f178.google.com ([209.85.192.178]:51857 "EHLO mail-pd0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755419AbaEFO0o (ORCPT ); Tue, 6 May 2014 10:26:44 -0400 Message-ID: <1399386402.15399.11.camel@edumazet-glaptop2.roam.corp.google.com> Subject: Re: [PATCH 06/24] net, diet: Use small UDP hash tables on small kernels From: Eric Dumazet To: Andi Kleen Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, tom.zanussi@linux.intel.com, Andi Kleen Date: Tue, 06 May 2014 07:26:42 -0700 In-Reply-To: <1399328773-6531-7-git-send-email-andi@firstfloor.org> References: <1399328773-6531-1-git-send-email-andi@firstfloor.org> <1399328773-6531-7-git-send-email-andi@firstfloor.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2014-05-05 at 15:25 -0700, Andi Kleen wrote: > From: Andi Kleen > > UDP has two hash tables, for UDP and UDP lite. Default > them to 16 entries each on small kernels. This can be > still overriden on the command line. > > Signed-off-by: Andi Kleen > --- > net/ipv4/udp.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c > index 4468e1a..90f967b 100644 > --- a/net/ipv4/udp.c > +++ b/net/ipv4/udp.c > @@ -2415,7 +2415,12 @@ void udp4_proc_exit(void) > } > #endif /* CONFIG_PROC_FS */ > > +#ifdef CONFIG_BASE_SMALL > +static __initdata unsigned long uhash_entries = 16; > +#else > static __initdata unsigned long uhash_entries; > +#endif > + > static int __init set_uhash_entries(char *str) > { > ssize_t ret; Its changed to UDP_HTABLE_SIZE_MIN later in alloc_large_system_hash() The reason there is a minimum UDP hash size is PORTS_PER_CHAIN, or DECLARE_BITMAP(bitmap, PORTS_PER_CHAIN) on stack. This patch has no effect on a small machine, because we already dynamically size this hash table. (The factor is one slot per 2MB of low memory)