Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _LINUX_SCHED_RCUPDATE_WAIT_H
0003 #define _LINUX_SCHED_RCUPDATE_WAIT_H
0004 
0005 /*
0006  * RCU synchronization types and methods:
0007  */
0008 
0009 #include <linux/rcupdate.h>
0010 #include <linux/completion.h>
0011 
0012 /*
0013  * Structure allowing asynchronous waiting on RCU.
0014  */
0015 struct rcu_synchronize {
0016     struct rcu_head head;
0017     struct completion completion;
0018 };
0019 void wakeme_after_rcu(struct rcu_head *head);
0020 
0021 void __wait_rcu_gp(bool checktiny, int n, call_rcu_func_t *crcu_array,
0022            struct rcu_synchronize *rs_array);
0023 
0024 #define _wait_rcu_gp(checktiny, ...) \
0025 do {                                    \
0026     call_rcu_func_t __crcu_array[] = { __VA_ARGS__ };       \
0027     struct rcu_synchronize __rs_array[ARRAY_SIZE(__crcu_array)];    \
0028     __wait_rcu_gp(checktiny, ARRAY_SIZE(__crcu_array),      \
0029             __crcu_array, __rs_array);          \
0030 } while (0)
0031 
0032 #define wait_rcu_gp(...) _wait_rcu_gp(false, __VA_ARGS__)
0033 
0034 /**
0035  * synchronize_rcu_mult - Wait concurrently for multiple grace periods
0036  * @...: List of call_rcu() functions for different grace periods to wait on
0037  *
0038  * This macro waits concurrently for multiple types of RCU grace periods.
0039  * For example, synchronize_rcu_mult(call_rcu, call_rcu_tasks) would wait
0040  * on concurrent RCU and RCU-tasks grace periods.  Waiting on a given SRCU
0041  * domain requires you to write a wrapper function for that SRCU domain's
0042  * call_srcu() function, with this wrapper supplying the pointer to the
0043  * corresponding srcu_struct.
0044  *
0045  * The first argument tells Tiny RCU's _wait_rcu_gp() not to
0046  * bother waiting for RCU.  The reason for this is because anywhere
0047  * synchronize_rcu_mult() can be called is automatically already a full
0048  * grace period.
0049  */
0050 #define synchronize_rcu_mult(...) \
0051     _wait_rcu_gp(IS_ENABLED(CONFIG_TINY_RCU), __VA_ARGS__)
0052 
0053 #endif /* _LINUX_SCHED_RCUPDATE_WAIT_H */