Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp710938pxj; Wed, 16 Jun 2021 11:45:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxdxXqZdN/k4neOnnbDfdhqIK34BWPfQgOb+oHuZKPJGz4sAeWHRbKlYGWByT9A7Ae/lFW+ X-Received: by 2002:a17:906:530e:: with SMTP id h14mr952756ejo.165.1623869114993; Wed, 16 Jun 2021 11:45:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623869114; cv=none; d=google.com; s=arc-20160816; b=XKXwuyXUAFSQkogbevkq0P2uOu/VIkR/OfcRKt+b3ngPEe4CrDxubtm63b9oLfagDd k/vaim9t93y0qlKpOXNTv6Bo4CEUt64BFH660iIIa/sJExLtcGnq77Hm1NTnRwmPsgsb Evy5n/NvheynpmzY9QYk3l4s4FI7WUo3Rc959JTA/tjvYFXDzERLlaZzxG8pyJnjPWIq OfZ5xadC2FRsd9qglvpxWTMMWBy+xIxSReOm0377Q9ykXCWgadxlpTAqDDWRG05TtzaS pLMxuRE9ytUOMjdJgED6h7y+lpLANtQLBTlcusURONJdZLoecpFn9ZddaWhRD2NjJWAK Eb+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=/KKFaNOwJJ64HA8ycqQn/B1R6RULjAs1yadcEz9FL+Y=; b=mwgyMlIr9WYfjuVozgA+hyY3GvfwrYSBLvW+RtQpnTjcM9r0zcwpCXAo5ytw40O69J OuEimkao7SwiZ2ESddkZ5RFTkpper7DgPb6sYOZdkFIzedSu5ypf5m6JxmXMNWUJnZO6 p3gwQ7WEokvJjarADjCZTmJ2j+V0BXWlNqHkeXSz96IE52nDqzUZ8CQAjyo9Ai8oP+wM F73ltw5KFozhoWn5z3P5mRQfGX3wQY/A2Rfwk1kiXTAnFw5znzSkpLcqGwV3AIxR+oJ3 SjD6on/YbuIzmsMg1Yd293Em/jziZIy0yLJu7Ns66fTepNdaKBgNvF57fkHfSJeYtRNg k97w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=SvHBAiYW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 26si3213139eja.192.2021.06.16.11.44.52; Wed, 16 Jun 2021 11:45:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=SvHBAiYW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232468AbhFPNV6 (ORCPT + 99 others); Wed, 16 Jun 2021 09:21:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230087AbhFPNVz (ORCPT ); Wed, 16 Jun 2021 09:21:55 -0400 Received: from mail-yb1-xb34.google.com (mail-yb1-xb34.google.com [IPv6:2607:f8b0:4864:20::b34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECB95C061574 for ; Wed, 16 Jun 2021 06:19:48 -0700 (PDT) Received: by mail-yb1-xb34.google.com with SMTP id e10so2972150ybb.7 for ; Wed, 16 Jun 2021 06:19:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/KKFaNOwJJ64HA8ycqQn/B1R6RULjAs1yadcEz9FL+Y=; b=SvHBAiYWj2gb1Kt2U4ro6iveRaJsLCayhCgHPdsYZnulD/5J//5IlSdxpNfQ+IGMBE LaMZprglaEJ7LN9/91lYEewFQ9EHDnC6a/YrjQZkhJKhyU281o/ms5k6bDfo53gH7mYl MgtEI9bGDvNgcbwzvPQj+ccSw9/dn3ZD3r9Aep8jJCYJMqD86gaDEpSUGEw2JzD9T0gK oYKg46u2TpAPsJeezXTkqcfR5LBFpYHfW2o9NhP70jyjpwzszoo2WfoWz0g00ewzMHqu Qei9buSfeLUNPLjpv37PF3lt7m+HqwRqXaS21dKeTfKCdvSH4buNCdM/hoEj8pzIJTkw Ypkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/KKFaNOwJJ64HA8ycqQn/B1R6RULjAs1yadcEz9FL+Y=; b=iAvF59oF6x2E8wULa9iJJkUUc6IZEuWf/nAWpV/Pe3qmjRXbX+0+YAsYmh8CqzHR0v mCrh71A2pxuboMBjCpSzqmY4CJ3+9VxnkmcJlbT/wQaWXzs2nrqDidtdAeOfRmB1v9X4 Uu2Z9yyxZRpCD7oQ3UwFBjQBExU3VCH18XAQvNEaAWzvo2mE3g5jhOfns1+QsBAD90GM WQI4LwiX2Vqs+VtfeCTOtk+LZdBGknwoHyVMUqpnUvz8UK3+V++UTckprWHtSQMlTAFc TvQQjrVL/LcIhBtu7rsEs3kz2IyGu4rDkA75soncQC5r6bVoCg3NtxynbhiglJEsiNR7 dBZg== X-Gm-Message-State: AOAM5313Xi685qd3EAqna1UhVFNLGfpN8UUme00N+7Xl7Q4LIVzlBDl2 PQErlyIFcRXPIixIQKc3X8Wr3++zoXhYzv+zHj0XJQ== X-Received: by 2002:a25:7ac5:: with SMTP id v188mr6959662ybc.132.1623849587386; Wed, 16 Jun 2021 06:19:47 -0700 (PDT) MIME-Version: 1.0 References: <20210512144743.039977287@linuxfoundation.org> <20210512144748.600206118@linuxfoundation.org> In-Reply-To: From: Eric Dumazet Date: Wed, 16 Jun 2021 15:19:35 +0200 Message-ID: Subject: Re: [PATCH 5.4 175/244] inet: use bigger hash table for IP ID generation To: David Laight Cc: Amit Klein , Greg Kroah-Hartman , "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" , Willy Tarreau , "David S. Miller" , Sasha Levin Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 16, 2021 at 12:19 PM David Laight wrote: > > From: Amit Klein > > Sent: 16 June 2021 10:17 > ... > > -#define IP_IDENTS_SZ 2048u > > - > > +/* Hash tables of size 2048..262144 depending on RAM size. > > + * Each bucket uses 8 bytes. > > + */ > > +static u32 ip_idents_mask __read_mostly; > ... > > + /* For modern hosts, this will use 2 MB of memory */ > > + idents_hash = alloc_large_system_hash("IP idents", > > + sizeof(*ip_idents) + sizeof(*ip_tstamps), > > + 0, > > + 16, /* one bucket per 64 KB */ > > + HASH_ZERO, > > + NULL, > > + &ip_idents_mask, > > + 2048, > > + 256*1024); > > + > > Can someone explain why this is a good idea for a 'normal' system? > > Why should my desktop system 'waste' 2MB of memory on a massive > hash table that I don't need. Only if your desktop has a lot of RAM. Otherwise the table will be smaller (like it was before this patch) > It might be needed by systems than handle massive numbers > of concurrent connections - but that isn't 'most systems'. > > Surely it would be better to detect when the number of entries > is comparable to the table size and then resize the table. Please send a patch, instead of always complaining about what others do. Security comes first. Then eventually we can ' optimize' . > > David > > - > Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK > Registration No: 1397386 (Wales)