Message ID | 20250214-slub-percpu-caches-v2-10-88592ee0966a@suse.cz (mailing list archive) |
---|---|
State | New |
Headers | show
Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4CBCE2686BD for <rcu@vger.kernel.org>; Fri, 14 Feb 2025 16:28:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739550509; cv=none; b=ZnTnl+1EHuPwbJnWabGIq3ety2ifAztixl+Svx5J68L7/qUCHCf6G3qXi/gE6xfZacpsIde2oeuyuXx8lw1B4BdDmKKrmmfa3vWKDoaN+gzP3wj8KANMxR/ubTpQRVd+smTV3fPhqkolE0nqKZz6AXHuxlUj1zq3++PNDshT+8s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739550509; c=relaxed/simple; bh=+/jxjeNoed6f3WIsfwDNXHdf+3L6dIl6W/NGO2VYBB8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QN+W6/sVEfF9JH+TIm83KCYcnYS8Z47yDOLv5I26nyVy8hKGy7Nsy9TLBUO0WibgJWdhAwyieGJnEG/5CvqPIuDS9s6kqAy+Rym5kLs/HrTrnVM1xT9+whEFY29sp1axTHj8EPUz/9yT6aphUn7WjWlQOk/twzo71mUNHQxNdUw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=fail smtp.mailfrom=suse.cz; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=1Sfg9Ax6; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=IYNEfDOY; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=1Sfg9Ax6; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=IYNEfDOY; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=suse.cz Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="1Sfg9Ax6"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="IYNEfDOY"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="1Sfg9Ax6"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="IYNEfDOY" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 371DD21183; Fri, 14 Feb 2025 16:27:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1739550463; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=T16uAqPiUIBFvh1y+XOpRJsYU5O35MddAzI5hsGnxGU=; b=1Sfg9Ax6vmxCiSzUpk3e66vDLftt8rQKFebqlLGjZ0TvIdfzEtst51K4S/2LTABKc+gD0G TlBmuAiYiEhUZp+14O4beyeQ2KajQ6eIk34Gcrvr/+oMMx+K4cxRR44oHmjlqupErELyq4 nFzsLA/ngzb05rtWVj3JdMypk8DskHQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1739550463; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=T16uAqPiUIBFvh1y+XOpRJsYU5O35MddAzI5hsGnxGU=; b=IYNEfDOYKORNe72O0TwyXRV3J/eKDdjVaF261+1F0sNRDzfOlN4dfARUgdZiPuOiVTeWu0 FqU4013rsia1YlDQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1739550463; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=T16uAqPiUIBFvh1y+XOpRJsYU5O35MddAzI5hsGnxGU=; b=1Sfg9Ax6vmxCiSzUpk3e66vDLftt8rQKFebqlLGjZ0TvIdfzEtst51K4S/2LTABKc+gD0G TlBmuAiYiEhUZp+14O4beyeQ2KajQ6eIk34Gcrvr/+oMMx+K4cxRR44oHmjlqupErELyq4 nFzsLA/ngzb05rtWVj3JdMypk8DskHQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1739550463; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=T16uAqPiUIBFvh1y+XOpRJsYU5O35MddAzI5hsGnxGU=; b=IYNEfDOYKORNe72O0TwyXRV3J/eKDdjVaF261+1F0sNRDzfOlN4dfARUgdZiPuOiVTeWu0 FqU4013rsia1YlDQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 2116613AFB; Fri, 14 Feb 2025 16:27:43 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id cC/MB/9ur2eHSAAAD6G6ig (envelope-from <vbabka@suse.cz>); Fri, 14 Feb 2025 16:27:43 +0000 From: Vlastimil Babka <vbabka@suse.cz> Date: Fri, 14 Feb 2025 17:27:46 +0100 Subject: [PATCH RFC v2 10/10] maple_tree: use percpu sheaves for maple_node_cache Precedence: bulk X-Mailing-List: rcu@vger.kernel.org List-Id: <rcu.vger.kernel.org> List-Subscribe: <mailto:rcu+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:rcu+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20250214-slub-percpu-caches-v2-10-88592ee0966a@suse.cz> References: <20250214-slub-percpu-caches-v2-0-88592ee0966a@suse.cz> In-Reply-To: <20250214-slub-percpu-caches-v2-0-88592ee0966a@suse.cz> To: Suren Baghdasaryan <surenb@google.com>, "Liam R. Howlett" <Liam.Howlett@oracle.com>, Christoph Lameter <cl@linux.com>, David Rientjes <rientjes@google.com> Cc: Roman Gushchin <roman.gushchin@linux.dev>, Hyeonggon Yoo <42.hyeyoo@gmail.com>, Uladzislau Rezki <urezki@gmail.com>, linux-mm@kvack.org, linux-kernel@vger.kernel.org, rcu@vger.kernel.org, maple-tree@lists.infradead.org, Vlastimil Babka <vbabka@suse.cz> X-Mailer: b4 0.14.2 X-Spam-Level: X-Spamd-Result: default: False [-6.80 / 50.00]; REPLY(-4.00)[]; BAYES_HAM(-3.00)[100.00%]; SUSPICIOUS_RECIPS(1.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; TAGGED_RCPT(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; RCPT_COUNT_TWELVE(0.00)[12]; RCVD_TLS_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; FROM_HAS_DN(0.00)[]; FREEMAIL_CC(0.00)[linux.dev,gmail.com,kvack.org,vger.kernel.org,lists.infradead.org,suse.cz]; R_RATELIMIT(0.00)[to_ip_from(RLtz7ce9b89hw8xzamye9qeynd)]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.cz:email,suse.cz:mid] X-Spam-Score: -6.80 X-Spam-Flag: NO |
Series |
SLUB percpu sheaves
|
expand
|
diff --git a/lib/maple_tree.c b/lib/maple_tree.c index f7153ade1be5f16423f0ca073846a7f3dfa60523..56e7a00f6f0941bff163091c999a873e4273f071 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -208,7 +208,7 @@ static void mt_free_rcu(struct rcu_head *head) static void ma_free_rcu(struct maple_node *node) { WARN_ON(node->parent != ma_parent_ptr(node)); - call_rcu(&node->rcu, mt_free_rcu); + kfree_rcu(node, rcu); } static void mas_set_height(struct ma_state *mas) @@ -6258,9 +6258,14 @@ bool mas_nomem(struct ma_state *mas, gfp_t gfp) void __init maple_tree_init(void) { + struct kmem_cache_args args = { + .align = sizeof(struct maple_node), + .sheaf_capacity = 32, + }; + maple_node_cache = kmem_cache_create("maple_node", - sizeof(struct maple_node), sizeof(struct maple_node), - SLAB_PANIC, NULL); + sizeof(struct maple_node), &args, + SLAB_PANIC); } /**
Setup the maple_node_cache with percpu sheaves of size 32 to hopefully improve its performance. Change the single node rcu freeing in ma_free_rcu() to use kfree_rcu() instead of the custom callback, which allows the rcu_free sheaf batching to be used. Note there are other users of mt_free_rcu() where larger parts of maple tree are submitted to call_rcu() as a whole, and that cannot use the rcu_free sheaf, but it's still possible for maple nodes freed this way to be reused via the barn, even if only some cpus are allowed to process rcu callbacks. Signed-off-by: Vlastimil Babka <vbabka@suse.cz> --- lib/maple_tree.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)