Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

srcu: API for barrier after srcu read unlock

srcu read lock/unlock include a full memory barrier
but that's an implementation detail.
Add an API for make memory fencing explicit for
users that need this barrier, to make sure we
can change it as needed without breaking all users.

Acked-by: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Gleb Natapov <gleb@redhat.com>

authored by

Michael S. Tsirkin and committed by
Gleb Natapov
ce332f66 80f5b5e7

+14
+14
include/linux/srcu.h
··· 237 237 __srcu_read_unlock(sp, idx); 238 238 } 239 239 240 + /** 241 + * smp_mb__after_srcu_read_unlock - ensure full ordering after srcu_read_unlock 242 + * 243 + * Converts the preceding srcu_read_unlock into a two-way memory barrier. 244 + * 245 + * Call this after srcu_read_unlock, to guarantee that all memory operations 246 + * that occur after smp_mb__after_srcu_read_unlock will appear to happen after 247 + * the preceding srcu_read_unlock. 248 + */ 249 + static inline void smp_mb__after_srcu_read_unlock(void) 250 + { 251 + /* __srcu_read_unlock has smp_mb() internally so nothing to do here. */ 252 + } 253 + 240 254 #endif