Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp332288pxj; Wed, 16 Jun 2021 03:32:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWBlzAPTxd7fOPWw4c6zY7vBg1YaXQ2o0vR8U7rldj8Qkg7iZLG8uwNKJoGGgNnD3V+ntA X-Received: by 2002:a17:906:b213:: with SMTP id p19mr4566088ejz.51.1623839552978; Wed, 16 Jun 2021 03:32:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623839552; cv=none; d=google.com; s=arc-20160816; b=oIS9Feq7r8BvCbkuR4zv35L7RGg0gdINsrCp/aXAI2EvevbhJlMHlxYF5aMysZWIwy pPw3GImMCdxCB81QkwMQAsfvRME+i6vpxLTT9WDTTBcrmYCXIXfcnnT2pQ5r7KQRMtQ1 ErxFb6PR4I/67j89XwlkubZeE90Snjs40Z1EKIbrANEFnlFJDcCcyK7IMigO896iP1sf wa/xz9IGOeszCK7e/sNgBgz/v4p5YcnZLL4zueQ8U5eoXcjxtShF9ZkRQXQ6Oione8xw S1S6r+SdAcuMJui+P9HzJk6fGrGa8qOOkNbRCeKlPetQDFe1Gn1RXyU+tUxV1r4MmWNJ JMpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=/W7Vld0NYy0fJ2eQKxrNrlQXeEsgv7170vJfUATkGZc=; b=FiAI1QsvDdOek0FFV3v9jhyi1AGJUjwf4rCs77hR8QZZtVxdxL4d4C0aD0RJIt2VwE zE6uJTKAfvlVPPrIDw/xTZJe2u6xCv0BI72fPzZ+g8BmMaGxPGuFYf9igXZYnl1IazhA mZ8g3XEAxhQuAGbSSNuZuqqiAqlbbMOBlz4psIvdDmofvN3YFckbDM0/YmmJfpyFD8cT at2Cg9c5ARUuJbhynlobtHfXvrvhw46OCbaUAek7Mv7Hz344OF/bJv2lMiBsJlYRJ60Y 5gNJ6d5BBn/3O3EWD8b08UeDBxC3LPYlv5Rs4iU+Nq3qtRSGf1iVm6nb6B2frPZFIw2M agKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oU+Oxzvx; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v29si2131313eda.351.2021.06.16.03.32.09; Wed, 16 Jun 2021 03:32:32 -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=@linuxfoundation.org header.s=korg header.b=oU+Oxzvx; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232375AbhFPKbQ (ORCPT + 99 others); Wed, 16 Jun 2021 06:31:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:47692 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232048AbhFPKbO (ORCPT ); Wed, 16 Jun 2021 06:31:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 96F4A60FE6; Wed, 16 Jun 2021 10:29:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623839349; bh=Z0UNEV6qSxs/ADJyTpVCdlAObn8GbfeoX2RCiE/Gv2g=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=oU+OxzvxmmwL10TJBoqn1VVSEX0vaisVNjzKh5YrHI/qu7atXiSVG2AiIEv+OBUUf LRln0CqIsVc9mG+0PRKLeFPWJNYCJHYLIpgCJ7yjXfMXA1YJS7sJE+KL1/xOxnKZz4 7q9sCPTngsDTlrnaNSWWIPQsoYs6m5vksC11lVIg= Date: Wed, 16 Jun 2021 12:29:06 +0200 From: Greg Kroah-Hartman To: David Laight Cc: 'Amit Klein' , "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" , Eric Dumazet , Willy Tarreau , "David S. Miller" , Sasha Levin Subject: Re: [PATCH 5.4 175/244] inet: use bigger hash table for IP ID generation Message-ID: References: <20210512144743.039977287@linuxfoundation.org> <20210512144748.600206118@linuxfoundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 16, 2021 at 10:19:15AM +0000, 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. > 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. Patches always gladly accepted.