From nobody Sun Dec 14 11:58:11 2025 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 B3369311C13 for ; Mon, 1 Sep 2025 11:09:20 +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=1756724962; cv=none; b=CiXD0kwHah6bccwxIS04DEE8FfgQraH26RTFcevVfMVkItPvnIdeg2UlMSYXGERtFhUzW1hZMibHRDMOd+0y6HM0wJ/7e3vO737a0/tU3H9PfsINliDETJKpMFy4XQJ9RVgJQgBzUTGPOV8bOPQcGAVXXzSZItdKDsYVI5qCFbo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756724962; c=relaxed/simple; bh=NEnPKJoh4PSRWp8CZDKpOmH3tB/16GPOtmyVTP2ZnoU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cg2hckUucTICpso6yACI03miUg5k6W86LrXNFT8+jwyhJ7/N4Fq11pANtKhE3C8joNvaEEgZRSPMG8Sb/OK0jzY1wDZeHFFLyRHg4eKcb3+i887GThvV7fz3Q8RcHpr1xaHFFxcCGCxGN7C811e9TKDoCTeMJfNSWh5seB+qJAM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=pass smtp.mailfrom=suse.cz; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=S0BrW2dO; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=80l0mWms; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=S0BrW2dO; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=80l0mWms; 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=pass 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="S0BrW2dO"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="80l0mWms"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="S0BrW2dO"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="80l0mWms" 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 AE99821179; Mon, 1 Sep 2025 11:08:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1756724933; 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=4DoczhIJm/QIxVWZ7D37eQBiOD25npSD9wVr63TFoHc=; b=S0BrW2dOwi0z04Wj3WboKaP8vSfpyJifHoyHj866eCywFn5ijYNZ0vaeOwjBE2J3qLBbw+ qz+BOxH5ouaguFBsCkcr6fVR4S7ROOOXNMteW/Xvgzh1f0BMVaMgNbcTU3OuKfwceRRVT0 69pdz8U4KZtb+qf8IHL06oF6EuwcRM0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1756724933; 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=4DoczhIJm/QIxVWZ7D37eQBiOD25npSD9wVr63TFoHc=; b=80l0mWmsnyMbEJ1/ElIfu3/n/y/ayVlDq6CjlfcCEDHZ6PPp9HlzPKAOV1w65VxnWdihjM j+7OpTNfqp/viPCQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1756724933; 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=4DoczhIJm/QIxVWZ7D37eQBiOD25npSD9wVr63TFoHc=; b=S0BrW2dOwi0z04Wj3WboKaP8vSfpyJifHoyHj866eCywFn5ijYNZ0vaeOwjBE2J3qLBbw+ qz+BOxH5ouaguFBsCkcr6fVR4S7ROOOXNMteW/Xvgzh1f0BMVaMgNbcTU3OuKfwceRRVT0 69pdz8U4KZtb+qf8IHL06oF6EuwcRM0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1756724933; 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=4DoczhIJm/QIxVWZ7D37eQBiOD25npSD9wVr63TFoHc=; b=80l0mWmsnyMbEJ1/ElIfu3/n/y/ayVlDq6CjlfcCEDHZ6PPp9HlzPKAOV1w65VxnWdihjM j+7OpTNfqp/viPCQ== 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 98E0413A3E; Mon, 1 Sep 2025 11:08:53 +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 EBALJcV+tWjtDgAAD6G6ig (envelope-from ); Mon, 01 Sep 2025 11:08:53 +0000 From: Vlastimil Babka Date: Mon, 01 Sep 2025 13:08:57 +0200 Subject: [PATCH 07/12] maple_tree: Use kfree_rcu in ma_free_rcu 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="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250901-maple-sheaves-v1-7-d6a1166b53f2@suse.cz> References: <20250901-maple-sheaves-v1-0-d6a1166b53f2@suse.cz> In-Reply-To: <20250901-maple-sheaves-v1-0-d6a1166b53f2@suse.cz> To: "Liam R. Howlett" , Matthew Wilcox , Lorenzo Stoakes , Jann Horn , Pedro Falcato , Suren Baghdasaryan Cc: Harry Yoo , Andrew Morton , maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Vlastimil Babka X-Mailer: b4 0.14.2 X-Spam-Level: X-Spamd-Result: default: False [-4.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-0.997]; MIME_GOOD(-0.10)[text/plain]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_TWELVE(0.00)[13]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; 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)[]; R_RATELIMIT(0.00)[to_ip_from(RLzz977skxseo48jckwk35q6sc)]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.cz:email,suse.cz:mid,imap1.dmz-prg2.suse.org:helo,suse.de:email] X-Spam-Flag: NO X-Spam-Score: -4.30 From: Pedro Falcato kfree_rcu is an optimized version of call_rcu + kfree. It used to not be possible to call it on non-kmalloc objects, but this restriction was lifted ever since SLOB was dropped from the kernel, and since commit 6c6c47b063b5 ("mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy(= )"). Thus, replace call_rcu + mt_free_rcu with kfree_rcu. Signed-off-by: Pedro Falcato Signed-off-by: Vlastimil Babka --- lib/maple_tree.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index a0db6bdc63793b8bbd544e246391d99e880dede3..d77e82362f03905040ac61630f9= 2fe9af1e59f98 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -191,13 +191,6 @@ static inline void mt_free_bulk(size_t size, void __rc= u **nodes) kmem_cache_free_bulk(maple_node_cache, size, (void **)nodes); } =20 -static void mt_free_rcu(struct rcu_head *head) -{ - struct maple_node *node =3D container_of(head, struct maple_node, rcu); - - kmem_cache_free(maple_node_cache, node); -} - /* * ma_free_rcu() - Use rcu callback to free a maple node * @node: The node to free @@ -208,7 +201,7 @@ static void mt_free_rcu(struct rcu_head *head) static void ma_free_rcu(struct maple_node *node) { WARN_ON(node->parent !=3D ma_parent_ptr(node)); - call_rcu(&node->rcu, mt_free_rcu); + kfree_rcu(node, rcu); } =20 static void mt_set_height(struct maple_tree *mt, unsigned char height) @@ -5281,7 +5274,7 @@ static void mt_free_walk(struct rcu_head *head) mt_free_bulk(node->slot_len, slots); =20 free_leaf: - mt_free_rcu(&node->rcu); + mt_free_one(node); } =20 static inline void __rcu **mte_destroy_descend(struct maple_enode **enode, @@ -5365,7 +5358,7 @@ static void mt_destroy_walk(struct maple_enode *enode= , struct maple_tree *mt, =20 free_leaf: if (free) - mt_free_rcu(&node->rcu); + mt_free_one(node); else mt_clear_meta(mt, node, node->type); } --=20 2.51.0