From: "Liam R. Howlett" <Liam.Howlett@oracle.com>
To: Pedro Falcato <pfalcato@suse.de>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Matthew Wilcox <willy@infradead.org>,
maple-tree@lists.infradead.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org,
Sidhartha Kumar <sidhartha.kumar@oracle.com>,
Vlastimil Babka <vbabka@suse.cz>
Subject: Re: [PATCH v2 1/3] testing/radix-tree/maple: Hack around kfree_rcu not existing
Date: Tue, 12 Aug 2025 15:41:35 -0400 [thread overview]
Message-ID: <erokvcuas3jqy3t4j2kjui47os4kph46swl5pjcrj5kd6lazlp@2epxbn57v6y4> (raw)
In-Reply-To: <20250812162124.59417-1-pfalcato@suse.de>
* Pedro Falcato <pfalcato@suse.de> [250812 12:21]:
> liburcu doesn't have kfree_rcu (or anything similar). Despite that, we
> can hack around it in a trivial fashion, by adding a wrapper.
>
> This wrapper only works for maple_nodes, and not anything else (due to
> us not being able to know rcu_head offsets in any way), and thus we take
> advantage of the type checking to avoid future silent breakage.
>
> Reviewed-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
> Signed-off-by: Pedro Falcato <pfalcato@suse.de>
> ---
> v2:
> - Move kfree_rcu hack to maple-shared.h, to fix userland VMA tests, per
> Lorenzo
This is going to cause issues with sheaves that's probably going to go
through vlastimil's branch.
We're going to either get this to go through there with some
modification to avoid conflict, or we're going to hold off for now.
>
> tools/testing/shared/maple-shared.h | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/tools/testing/shared/maple-shared.h b/tools/testing/shared/maple-shared.h
> index dc4d30f3860b..572cd2580123 100644
> --- a/tools/testing/shared/maple-shared.h
> +++ b/tools/testing/shared/maple-shared.h
> @@ -9,5 +9,20 @@
> #include <stdlib.h>
> #include <time.h>
> #include "linux/init.h"
> +#include <linux/maple_tree.h>
> +
> +static inline void free_node(struct rcu_head *head)
> +{
> + struct maple_node *node = container_of(head, struct maple_node, rcu);
> +
> + free(node);
> +}
> +
> +static inline void kfree_rcu_node(struct maple_node *node)
> +{
> + call_rcu(&node->rcu, free_node);
> +}
> +
> +#define kfree_rcu(ptr, memb) kfree_rcu_node(ptr)
>
> #endif /* __MAPLE_SHARED_H__ */
> --
> 2.50.1
>
next prev parent reply other threads:[~2025-08-12 19:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-12 16:21 Pedro Falcato
2025-08-12 16:21 ` [PATCH v2 2/3] maple_tree: Use kfree_rcu in ma_free_rcu Pedro Falcato
2025-08-12 16:21 ` [PATCH v2 3/3] maple_tree: Replace mt_free_one() with kfree() Pedro Falcato
2025-08-12 19:41 ` Liam R. Howlett [this message]
2025-08-15 15:11 ` [PATCH v2 1/3] testing/radix-tree/maple: Hack around kfree_rcu not existing Liam R. Howlett
2025-08-15 17:06 ` Pedro Falcato
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=erokvcuas3jqy3t4j2kjui47os4kph46swl5pjcrj5kd6lazlp@2epxbn57v6y4 \
--to=liam.howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=maple-tree@lists.infradead.org \
--cc=pfalcato@suse.de \
--cc=sidhartha.kumar@oracle.com \
--cc=vbabka@suse.cz \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox