diff options
| author | Paul E. McKenney <paulmck@kernel.org> | 2026-09-02 12:58:24 -0700 |
|---|---|---|
| committer | Paul E. McKenney <paulmck@kernel.org> | 2026-10-12 16:50:39 -0700 |
| commit | 06726ed5906d6a403a79e78f80a428ffcbe0bbb4 (patch) | |
| tree | d3350794387ba6bbd82ebcdeedfce711a03d0e09 /include/linux | |
| parent | 494fa5fcb1de0a1d3b7f864db35877ad552f39ad (diff) | |
| download | linux-06726ed5906d6a403a79e78f80a428ffcbe0bbb4.tar.gz linux-06726ed5906d6a403a79e78f80a428ffcbe0bbb4.zip | |
srcutree: Explicitly note DEFINE_SRCU() needs for srcu_barrier()
In the core kernel, an srcu_struct structure created by DEFINE_SRCU()
or friends lives as long as the kernel does, so there are no particular
requirements surrounding the end of that structure's life. In contrast,
when DEFINE_SRCU() and friends are used within a module, the corresponding
srcu_struct structures' lifetimes end when that module exits. This in
turn means that if such a structure was passed to call_srcu(), then
srcu_barrier() must be invoked after the last call_srcu() invocation
but before the module exits.
This commit therefore adds a comment stating this.
Reported-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/srcutree.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/srcutree.h b/include/linux/srcutree.h index ad9d9658b0a2..93b76e543894 100644 --- a/include/linux/srcutree.h +++ b/include/linux/srcutree.h @@ -214,6 +214,12 @@ struct srcu_struct { * instead of smp_mb(), and given that the first (for example) * srcu_read_lock_fast() might race with the first synchronize_srcu(), * this different must be specified at initialization time. + * + * If you use any of the DEFINE_SRCU() functions within a module, the + * module-entry code will invoke init_srcu_struct() and the module-exit + * code will invoke cleanup_srcu_struct(). This means that if your module + * passes the resulting srcu_struct structure to call_srcu(), you will + * need to also pass this structure to srcu_barrier() prior to module exit. */ #ifdef MODULE # define __DEFINE_SRCU(name, fast, is_static) \ |
