summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorUladzislau Rezki (Sony) <urezki@gmail.com>2024-08-20 18:59:35 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-11-08 18:31:04 +0300
commit3cce0362ee92d089dc93ab1099e1d1c8f0dde7a5 (patch)
tree575203bb7893d06a08703d488c41b994f4ea8b5b /include
parent0ee23db48fcc1f00122516e0ecb35665dcd6e08e (diff)
downloadlinux-3cce0362ee92d089dc93ab1099e1d1c8f0dde7a5.tar.xz
rcu/kvfree: Add kvfree_rcu_barrier() API
commit 2b55d6a42d14c8675e38d6d9adca3014fdf01951 upstream. Add a kvfree_rcu_barrier() function. It waits until all in-flight pointers are freed over RCU machinery. It does not wait any GP completion and it is within its right to return immediately if there are no outstanding pointers. This function is useful when there is a need to guarantee that a memory is fully freed before destroying memory caches. For example, during unloading a kernel module. Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com> Signed-off-by: Vlastimil Babka <vbabka@suse.cz> Signed-off-by: Suren Baghdasaryan <surenb@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/rcutiny.h5
-rw-r--r--include/linux/rcutree.h1
2 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index d9ac7b136aea..522123050ff8 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -111,6 +111,11 @@ static inline void __kvfree_call_rcu(struct rcu_head *head, void *ptr)
kvfree(ptr);
}
+static inline void kvfree_rcu_barrier(void)
+{
+ rcu_barrier();
+}
+
#ifdef CONFIG_KASAN_GENERIC
void kvfree_call_rcu(struct rcu_head *head, void *ptr);
#else
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index 254244202ea9..58e7db80f3a8 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -35,6 +35,7 @@ static inline void rcu_virt_note_context_switch(void)
void synchronize_rcu_expedited(void);
void kvfree_call_rcu(struct rcu_head *head, void *ptr);
+void kvfree_rcu_barrier(void);
void rcu_barrier(void);
void rcu_momentary_dyntick_idle(void);