Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp631693rbb; Sat, 24 Feb 2024 17:22:33 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVtIkR4LR4hIJZY2i07NusG0u8Qn9FXOhWD3J/xgH+KfZSDy0ZTSn2iYj/mAUHscmohbLppgPgwfCTOtz7juyxHVzKVvwiht9VgIJeNAg== X-Google-Smtp-Source: AGHT+IHVgbA3/Dudr9r0GX1WVNZZuXFLv7SZCsLTNq7TO5JPqcSjZgXvx5FNVUg+2wRpgOnk6sO5 X-Received: by 2002:a05:6a20:d906:b0:1a0:f84f:86cf with SMTP id jd6-20020a056a20d90600b001a0f84f86cfmr164238pzb.35.1708824153042; Sat, 24 Feb 2024 17:22:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708824153; cv=pass; d=google.com; s=arc-20160816; b=Luusjs5IPZiIXKU9KOqua6Gk2fMlW2Rr1JIOSWAohH2Rba1xfFFjUATsZJgrZdqmdf BOTAjHELfoMRVyUar+NDVY3unNq4V+X9sok/TSdjDDyDeVVPbMiziL93FrtRRg7sV1nj rVM6+6R5GFN6pEzGumf2u2cWM3PMHN2TdFdzyVSs2D3EYIktA9KQOTFTd/Q9qmIuUh5U TSAJbqha1QOXa/FgTyl8063u4e1YUEBwt/awmrruZDkpwkFn/KvWDfZ3o6Xpr5iWo5Ht eh0BQVzY9PcCa1cBuMyLhbBmb0NqeX576wdZfZ0ODaQ1n3igc1zDWCdrhO34wBZlVmIe 6NmA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=he92CbZs3RtrCrQSTadwuvhkek3afDYpIa6rdJ3DppY=; fh=JCBTMCoprPxL6Pjm0Ttpcgb5p2T7rDBdaqASiklpe18=; b=XXq+uh4meJkdFTi11bd9ja0PvD1OyIkJTAbbTYTOmI7Z7iyq9kB0jzP9OtPPkCCAze mNZExwIquebJfGMWdYu5UWwHsMqV2H6loizjdaBNa5r+48b8pCJPVIqvC02tH+RrGPka pKas7uvSxZAOqHaMqu2zfjMdkk0BQvIJK5j7IYQmZ0nZWnjXjGgsCC/QMSU1dCqv5RjG hvKG8B7aMkzmvL6WEZK9Q8gLZcZ8E28xjihtgW9qXcNL5ifhd4fO4443VC6jdcklszPt g7sWSgpFLdQNakgZsqIFrvJ+b4NicL+AjSwtnaKo+Q6F2kn/+/nf8v6ym+rT5T21recZ Mmgw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gondor.apana.org.au dmarc=pass fromdomain=gondor.apana.org.au); spf=pass (google.com: domain of linux-kernel+bounces-79922-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79922-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=REJECT sp=QUARANTINE dis=NONE) header.from=apana.org.au Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id q2-20020a170902eb8200b001dc832a7265si1477406plg.555.2024.02.24.17.22.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 17:22:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-79922-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gondor.apana.org.au dmarc=pass fromdomain=gondor.apana.org.au); spf=pass (google.com: domain of linux-kernel+bounces-79922-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79922-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=REJECT sp=QUARANTINE dis=NONE) header.from=apana.org.au Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id B6B79282258 for ; Sun, 25 Feb 2024 01:22:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A7A225C83; Sun, 25 Feb 2024 01:22:20 +0000 (UTC) Received: from abb.hmeau.com (abb.hmeau.com [144.6.53.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B5DF10E4; Sun, 25 Feb 2024 01:22:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=144.6.53.87 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708824140; cv=none; b=KHU3sOVhBiUH/JVQf0qq2MSW6GiWyYSwv9vnBtY5KTucuOwDZdYviMx0SFxfl37qkqezTO292Ykg++WrO6C6iiGB3RvJvAoR9514U80geQgg58J2cxrpM0NFio7up8Vs7R58/jIOl0p/ds8um6wbpz1MdFJOwzL9I2ST/wH/blQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708824140; c=relaxed/simple; bh=8MxMrxDjatcZ9KrlHxfNOi3v9JyPHdQJ3JtwZyYIXhM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Zt77nqfgl2MyzI0N3+BgYEVMenMMHKWX3WVO66WI4FHHUqqf33306BdiuM+KOJqKth5jobvfM+zjQQkda0BYEWkkKHUNvyxYk69XpXFkH0Ek4KuybcAcRsY0Z8xCEaFf9eZi4p/IUilPmvuuJNw2eT4rxZUqviiJHPXrphuQ0lE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gondor.apana.org.au; spf=pass smtp.mailfrom=gondor.apana.org.au; arc=none smtp.client-ip=144.6.53.87 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gondor.apana.org.au Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gondor.apana.org.au Received: from loth.rohan.me.apana.org.au ([192.168.167.2]) by formenos.hmeau.com with smtp (Exim 4.94.2 #2 (Debian)) id 1re2ij-00HTZ9-Uf; Sun, 25 Feb 2024 08:50:23 +0800 Received: by loth.rohan.me.apana.org.au (sSMTP sendmail emulation); Sun, 25 Feb 2024 08:50:36 +0800 Date: Sun, 25 Feb 2024 08:50:36 +0800 From: Herbert Xu To: David Laight Cc: "Matthew Wilcox (Oracle)" , "linux-kernel@vger.kernel.org" , Thomas Graf , "netdev@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "maple-tree@lists.infradead.org" , "rcu@vger.kernel.org" Subject: Re: [PATCH 0/1] Rosebush, a new hash table Message-ID: References: <20240222203726.1101861-1-willy@infradead.org> <4a1416fcb3c547eb9612ce07da6a77ed@AcuMS.aculab.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4a1416fcb3c547eb9612ce07da6a77ed@AcuMS.aculab.com> On Sat, Feb 24, 2024 at 10:10:27PM +0000, David Laight wrote: > > > Normally an rhashtable gets resized when it reaches 75% capacity > > so the average chain length should always be one. > > The average length of non-empty hash chains is more interesting. > You don't usually search for items in empty chains. > The only way you'll get all the chains of length one is if you've > carefully picked the data so that it hashed that way. Sure. But given the 75% capacity, you'd need a really bad hash function to get an *average* (not worst-case) chain length of 10. > I remember playing around with the elf symbol table for a browser > and all its shared libraries. > While the hash function is pretty trivial, it really didn't matter > whether you divided 2^n, 2^n-1 or 'the prime below 2^n' some hash > chains were always long. Even in the unlikely event of bad luck and everything bunches up together, we change theh hash function (through hash_rnd) every time we resize so you would expect things to even out after the resize event. A rehash is also automatically triggered if the worst-case chain length exceeds 16. Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt