~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/rcupdate_wait.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef _LINUX_SCHED_RCUPDATE_WAIT_H
  3 #define _LINUX_SCHED_RCUPDATE_WAIT_H
  4 
  5 /*
  6  * RCU synchronization types and methods:
  7  */
  8 
  9 #include <linux/rcupdate.h>
 10 #include <linux/completion.h>
 11 #include <linux/sched.h>
 12 
 13 /*
 14  * Structure allowing asynchronous waiting on RCU.
 15  */
 16 struct rcu_synchronize {
 17         struct rcu_head head;
 18         struct completion completion;
 19 };
 20 void wakeme_after_rcu(struct rcu_head *head);
 21 
 22 void __wait_rcu_gp(bool checktiny, unsigned int state, int n, call_rcu_func_t *crcu_array,
 23                    struct rcu_synchronize *rs_array);
 24 
 25 #define _wait_rcu_gp(checktiny, state, ...) \
 26 do {                                                                                            \
 27         call_rcu_func_t __crcu_array[] = { __VA_ARGS__ };                                       \
 28         struct rcu_synchronize __rs_array[ARRAY_SIZE(__crcu_array)];                            \
 29         __wait_rcu_gp(checktiny, state, ARRAY_SIZE(__crcu_array), __crcu_array, __rs_array);    \
 30 } while (0)
 31 
 32 #define wait_rcu_gp(...) _wait_rcu_gp(false, TASK_UNINTERRUPTIBLE, __VA_ARGS__)
 33 #define wait_rcu_gp_state(state, ...) _wait_rcu_gp(false, state, __VA_ARGS__)
 34 
 35 /**
 36  * synchronize_rcu_mult - Wait concurrently for multiple grace periods
 37  * @...: List of call_rcu() functions for different grace periods to wait on
 38  *
 39  * This macro waits concurrently for multiple types of RCU grace periods.
 40  * For example, synchronize_rcu_mult(call_rcu, call_rcu_tasks) would wait
 41  * on concurrent RCU and RCU-tasks grace periods.  Waiting on a given SRCU
 42  * domain requires you to write a wrapper function for that SRCU domain's
 43  * call_srcu() function, with this wrapper supplying the pointer to the
 44  * corresponding srcu_struct.
 45  *
 46  * Note that call_rcu_hurry() should be used instead of call_rcu()
 47  * because in kernels built with CONFIG_RCU_LAZY=y the delay between the
 48  * invocation of call_rcu() and that of the corresponding RCU callback
 49  * can be multiple seconds.
 50  *
 51  * The first argument tells Tiny RCU's _wait_rcu_gp() not to
 52  * bother waiting for RCU.  The reason for this is because anywhere
 53  * synchronize_rcu_mult() can be called is automatically already a full
 54  * grace period.
 55  */
 56 #define synchronize_rcu_mult(...) \
 57         _wait_rcu_gp(IS_ENABLED(CONFIG_TINY_RCU), TASK_UNINTERRUPTIBLE, __VA_ARGS__)
 58 
 59 static inline void cond_resched_rcu(void)
 60 {
 61 #if defined(CONFIG_DEBUG_ATOMIC_SLEEP) || !defined(CONFIG_PREEMPT_RCU)
 62         rcu_read_unlock();
 63         cond_resched();
 64         rcu_read_lock();
 65 #endif
 66 }
 67 
 68 #endif /* _LINUX_SCHED_RCUPDATE_WAIT_H */
 69 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php