Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp31604rbb; Fri, 23 Feb 2024 10:41:21 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWukgcNz8EhWg8RXc3eUvAVh4Bbb574g4zogENe9dl1O5ABVHwKqTirULCcwnw74xUbo3UHhgxXkTj15dG7+S+iQ+aIDJvCTPZvYWH2pw== X-Google-Smtp-Source: AGHT+IGf37Wglm59IjyczG0oytrWHtR99d3680COaNUv0Xuqu/wAVBiQvfCQy/Vtp6Dtsp+TSyCo X-Received: by 2002:a17:906:3759:b0:a3f:436a:1e41 with SMTP id e25-20020a170906375900b00a3f436a1e41mr438939ejc.53.1708713680852; Fri, 23 Feb 2024 10:41:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708713680; cv=pass; d=google.com; s=arc-20160816; b=fFmTrq1amfuhLL+9kbGYqxuYMXPA97ze7xG9Dq0M1ccbv1RofGE1kirX9Z2dRfuH4H ooPkz7RYpn+we9obGkodUkZTL1+35M+29/RbAK8qE8Pfbs13iICT9fxLYZxUrYkq3cJ/ KjqcRxxPLE2w7lSLy/fM4FAGosWi1Vg54yze5RMMhaTejMd23xsm87ceGMU8+aGKR3hm n39I8cEK3x74ZOwBDQyQQU4kJ3se1dEixu38G0PF9KoTFmkf0BWUV2L/ey/9/dfHLfxS sU9llbuCJcJMOjV9P6XZhFwBrzXCxmwO9z5im6XObpglBYjAcm7OIG8JF6PDwO2nAYU2 o0xQ== 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=TtVW+3bSqdUyNHjHnisMJsaNnmBRav1E+zZ0KWEbo8k=; fh=YXSkwl1V6O0p2QHcRC/lOxbAhzvfkKG02oE1MZ2+Ruw=; b=u7zBbXdsVrFU8CEAfCHUGuvF0GqXjn31fOesk7g+lTAdzWFQqECSitRgHT6HN2Oxp4 MC47RRcY0f3G1exJOzGq7/av7KQ/2Jv0Rm5u7HRQyGbh1EUJ2xY60ySu1IImtmfwFdZ1 tL3PkY6DQl9Dn/DMUutqV20Zjj1ofXR9zBOCNHVNSwyQxd6tKNTG96OL8ZJ9NqzEE7YN Miruq2ckzcpasafq7jFNNU2lDjvzcuSHQZrsrkETP2fQdrhjRwxq+qjLaOeK37jDvTPu D9YVAIhDx5u2EXr50KJyZnCUR68VGPTaEHYXprvlgHh4jk1F/jeJx7WY68nFXrfdWK6u ILNw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=JVl01BxN; 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-78994-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78994-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. [147.75.80.249]) by mx.google.com with ESMTPS id q7-20020a17090622c700b00a3efce732ecsi3607740eja.379.2024.02.23.10.41.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 10:41:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78994-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=JVl01BxN; 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-78994-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78994-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 9C50A1F29258 for ; Fri, 23 Feb 2024 18:41:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C57B0143C59; Fri, 23 Feb 2024 18:41:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="JVl01BxN" Received: from out-182.mta0.migadu.com (out-182.mta0.migadu.com [91.218.175.182]) (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 D485113F010 for ; Fri, 23 Feb 2024 18:41:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708713668; cv=none; b=R4b6O8RD+sf28V/bJT2VdSm4uzHinTt8ruTyIFjRQ3bdXWdNMx/j1PZBJteTdQVgh0atluEjByYgshi+QD61Qr5Zqs5N5DJcZqDMauXHvbVEsEjML87YUZ8yHFS8ahWtL9hsRPKySopSsbDnjY9JETV+3FBZotAE+XCLY5x9upE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708713668; c=relaxed/simple; bh=BKmU1ottIKZg7mi7mY2yCA6PoDkcs/iUSw4v0HQkrS8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Edaav0JT1A2WeRUpQ6Fmyjkw2G9niQrFDmIKi6Y0owYBkgFYnBkCfNocVDDxka9dfU6uFAfHhDE47po2A9v/T+tOEPlFBpSwFeXH31gydB+jOmju2QZ7870kD1+yZz5SeGV+DwD3EVulHxXcYbTG2PaYrVirDIDFgdj14lIcpx4= 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=JVl01BxN; arc=none smtp.client-ip=91.218.175.182 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: Fri, 23 Feb 2024 13:40:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1708713660; 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=TtVW+3bSqdUyNHjHnisMJsaNnmBRav1E+zZ0KWEbo8k=; b=JVl01BxN5WobZivCOUkRPMMLHVzo7x8aYNQ5FNsgndbGS+8V1ajGL4xF/JGkyBhLNcv+1J A5HfAOu0GBXMAxAYhb6QderZu9l4gHgrz+KouVyM8vhplGKqmvbOJdld9YfMqiw4z25mfc 8MqWXIEpMqAooqsXLIPsEMOaOiWKlJo= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: "Matthew Wilcox (Oracle)" Cc: linux-kernel@vger.kernel.org, Thomas Graf , Herbert Xu , 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> 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: <20240222203726.1101861-1-willy@infradead.org> X-Migadu-Flow: FLOW_OUT On Thu, Feb 22, 2024 at 08:37:23PM +0000, Matthew Wilcox (Oracle) wrote: > Rosebush is a resizing, scalable, cache-aware, RCU optimised hash table. > I've written a load of documentation about how it works, mostly in > Documentation/core-api/rosebush.rst but some is dotted through the > rosebush.c file too. > > You can see this code as a further exploration of the "Linked lists are > evil" design space. For the workloads which a hashtable is suited to, > it has lower overhead than either the maple tree or the rhashtable. > It cannot support ranges (so is not a replacement for the maple tree), > but it does have per-bucket locks so is more scalable for write-heavy > workloads. I suspect one could reimplement the rhashtable API on top > of the rosebush, but I am not interested in doing that work myself. > > The per-object overhead is 12 bytes, as opposed to 16 bytes for the > rhashtable and 32 bytes for the maple tree. The constant overhead is also > small, being just 16 bytes for the struct rosebush. The exact amount > of memory consumed for a given number of objects is going to depend on > the distribution of hashes; here are some estimated consumptions for > power-of-ten entries distributed evenly over a 32-bit hash space in the > various data structures: > > number xarray maple rhash rosebush > 1 3472 272 280 256 > 10 32272 784 424 256 > 100 262kB 3600 1864 2080 > 1000 [1] 34576 17224 16432 > 10k [1] 343k 168392 131344 > 100k [1] 3.4M 1731272 2101264 So I think the interesting numbers to see (besides performance numbers) are going to be the fill factor numbers under real world use. It's an interesting technique, I've played around with it a bit (actually using it in bcachefs for the nocow locks hash table), but no idea if it makes sense as a general purpose thing yet... you also mentioned that a motivation was API mismatch between rhashtable and dcache - could you elaborate on that?