Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp658769rbb; Sat, 24 Feb 2024 19:21:07 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVTAVNBIdDIl4ChAesdd+ST9wPyF2iSR8Ljh8SmFuUDOtsUGENip6PKB+6TaLpo7xMTfOwRsoF8MFmC1Wbc2wQ/viaRe5afk+5K4n0zCA== X-Google-Smtp-Source: AGHT+IE4HtawWBmPokq03Elo7fEHTch1EAKpBMNLocibWv4OrC53TVVLEI8e1hjZDxLP9aVZCJ3I X-Received: by 2002:a05:6402:1289:b0:564:3c79:930 with SMTP id w9-20020a056402128900b005643c790930mr2716844edv.23.1708831267616; Sat, 24 Feb 2024 19:21:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708831267; cv=pass; d=google.com; s=arc-20160816; b=NudCURVX5mifkUJpf+/q30Q3CSTQ/Bnjc2OatvuSqh+jxD1NDMNFl0F1QEzwruukJt OUFJnwHMw9bvPCf5c0GTSQP1MBu0DkHeLssUJdJJOEmLQrWe5jv2cFt0kGilU8NF2wVb MgNn3SXbwCnej6D43xcOsi+GZsSLAUMav11TNay/xaP0YgzVUKx+VQCI3XbkBvTpKM/o YT2QjRymUIUtsETZ3GYgTcA2IfA8P72eC3G18OD21Pq4WFJyJ8OS9iLUixHoUqBbKufd iRAfZNIYAZQWJy8qZQamBE/ElXLYKJ9VVFGyWIXLcjxROfa0lb/Rb+8HbYb4lisTgjLm tYQA== 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:dkim-signature:date; bh=U9J1yKDnvDl6KolyPgEXqei4kWuchDlY2Ell6cdvMf0=; fh=J901JGOEidsswA9Nh/fv9So+mSr9//BGllrVudE9lA4=; b=uktNCSH8D13MgX0GD7tVSMOZPYlRAPSpiH+L/Or01BWYARRkgcrKIseY96uKI03sd2 cA+pfjco0NLlrDeKQEX9s8d1dYbLFKy3HwfU0o7qgCrOS4NFlc5t14dIuf7aHAqCswNJ /92TtxY4jcAGT/aX5bnj58tIFvf8IUPe/idqOVBrHvHQXdrVQL+qitwPMYi4OG8um9xw LA3wKB0KN1qEfM3iD6WxcRAI+6haMGcSbBUMZz7GIWQP/dZXijf1gBkF/4a3tmUFqMB0 GvVYva2J68zcw2jTiA+rqFpzNqpiLf+aaBDrqCC0rg7qapWXlXUKBUtOkLE8T6ZqnDiu KVMQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=uiZtspxh; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-79959-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79959-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id v17-20020a50a451000000b00564b1413ab8si926905edb.83.2024.02.24.19.21.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 19:21:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-79959-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=uiZtspxh; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-79959-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79959-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 1DCBA1F21566 for ; Sun, 25 Feb 2024 03:21:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8AF677476; Sun, 25 Feb 2024 03:20:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="uiZtspxh" Received: from out-176.mta0.migadu.com (out-176.mta0.migadu.com [91.218.175.176]) (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 196A35382 for ; Sun, 25 Feb 2024 03:20:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708831256; cv=none; b=ibn+SLH5IyQVInOtESyYisKI8IcS0nLCA82XrNZPiofMmTNDqx+5xDMhOl8OGk9SiYm+JXXYP9LOBexXIwZVtuLf0td2OZIQ7bAyFkD0/+e+q8r3USPHBKIRmyk6JVoDAwkycu8zMzxp433s3Y+7O7JtADvjDktMXdMrdFTMWw0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708831256; c=relaxed/simple; bh=xFKowyoMhCu8KoyOJwEQdR7hyiU/GR4QHk9WLiDY8Oc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=TKX/S1Ubgqighq/1/QXTT1x8+Mvag/UMn1tAWjRQX08Lt99tBWWFbGOIa4vMiFM8GgawLZ6e2ofFzP3UZBiK5GIrS5Yt4RxkJDetZYgJQzkKQ2LFIa4d4y244rpsDzZYFX4DUYSIwm/DJLPCQoF0v6xGy1d9247Ig0XXKeYSSZw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=uiZtspxh; arc=none smtp.client-ip=91.218.175.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Date: Sat, 24 Feb 2024 22:20:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1708831252; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=U9J1yKDnvDl6KolyPgEXqei4kWuchDlY2Ell6cdvMf0=; b=uiZtspxhcPDcD+TaJbQ3sUa9gdhY/699uXROpsOvonTdLCBd6xwRAtAIfpFDJpZJlIwG8Y FNR5P5cW1RZsVfmHpllBXBwqQ81G+JIQ9iClq1Lfrsp7bZOgnemR8gaWE8t/Jk6/jhzgLU bFuDazUhBfHkR5ZlMvpRf0swK0kzhHo= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Herbert Xu Cc: David Laight , "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: X-Migadu-Flow: FLOW_OUT On Sun, Feb 25, 2024 at 08:50:36AM +0800, Herbert Xu wrote: > 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. 16!? that's crap, use a decent hash function and 3-5 should be your worst upper bound.