diff mbox series

[2/4] libxfs: add a kfree_rcu_mightsleep stub

Message ID 20240812063243.3806779-3-hch@lst.de (mailing list archive)
State New
Headers show
Series [1/4] libfrog: add xarray emulation | expand

Commit Message

Christoph Hellwig Aug. 12, 2024, 6:32 a.m. UTC
Add a kfree_rcu_mightsleep stub so that code that needs to RCU free
AGs in kernelspace can simply use this helper in xfsprogs.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 include/kmem.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/include/kmem.h b/include/kmem.h
index 8dfb2fb0b..b61385ec4 100644
--- a/include/kmem.h
+++ b/include/kmem.h
@@ -65,6 +65,16 @@  static inline void kfree(const void *ptr)
 	free((void *)ptr);
 }
 
+/*
+ * Stub for the kernel kfree_rcu_mightsleep.  Does not actually wait
+ * for a RCU grace period, so can only be used in code that does not
+ * require RCU protection in userspace.
+ */
+static inline void kfree_rcu_mightsleep(const void *ptr)
+{
+	kfree(ptr);
+}
+
 __attribute__((format(printf,2,3)))
 char *kasprintf(gfp_t gfp, const char *fmt, ...);