1b5b11890SPaul E. McKenney /* SPDX-License-Identifier: GPL-2.0+ */ 24102adabSPaul E. McKenney /* 34102adabSPaul E. McKenney * Read-Copy Update definitions shared among RCU implementations. 44102adabSPaul E. McKenney * 54102adabSPaul E. McKenney * Copyright IBM Corporation, 2011 64102adabSPaul E. McKenney * 7b5b11890SPaul E. McKenney * Author: Paul E. McKenney <paulmck@linux.ibm.com> 84102adabSPaul E. McKenney */ 94102adabSPaul E. McKenney 104102adabSPaul E. McKenney #ifndef __LINUX_RCU_H 114102adabSPaul E. McKenney #define __LINUX_RCU_H 124102adabSPaul E. McKenney 135cb5c6e1SPaul Gortmaker #include <trace/events/rcu.h> 144102adabSPaul E. McKenney 152e8c28c2SPaul E. McKenney /* 162e8c28c2SPaul E. McKenney * Grace-period counter management. 17*3636d8d1SFrederic Weisbecker * 18*3636d8d1SFrederic Weisbecker * The two least significant bits contain the control flags. 19*3636d8d1SFrederic Weisbecker * The most significant bits contain the grace-period sequence counter. 20*3636d8d1SFrederic Weisbecker * 21*3636d8d1SFrederic Weisbecker * When both control flags are zero, no grace period is in progress. 22*3636d8d1SFrederic Weisbecker * When either bit is non-zero, a grace period has started and is in 23*3636d8d1SFrederic Weisbecker * progress. When the grace period completes, the control flags are reset 24*3636d8d1SFrederic Weisbecker * to 0 and the grace-period sequence counter is incremented. 25*3636d8d1SFrederic Weisbecker * 26*3636d8d1SFrederic Weisbecker * However some specific RCU usages make use of custom values. 27*3636d8d1SFrederic Weisbecker * 28*3636d8d1SFrederic Weisbecker * SRCU special control values: 29*3636d8d1SFrederic Weisbecker * 30*3636d8d1SFrederic Weisbecker * SRCU_SNP_INIT_SEQ : Invalid/init value set when SRCU node 31*3636d8d1SFrederic Weisbecker * is initialized. 32*3636d8d1SFrederic Weisbecker * 33*3636d8d1SFrederic Weisbecker * SRCU_STATE_IDLE : No SRCU gp is in progress 34*3636d8d1SFrederic Weisbecker * 35*3636d8d1SFrederic Weisbecker * SRCU_STATE_SCAN1 : State set by rcu_seq_start(). Indicates 36*3636d8d1SFrederic Weisbecker * we are scanning the readers on the slot 37*3636d8d1SFrederic Weisbecker * defined as inactive (there might well 38*3636d8d1SFrederic Weisbecker * be pending readers that will use that 39*3636d8d1SFrederic Weisbecker * index, but their number is bounded). 40*3636d8d1SFrederic Weisbecker * 41*3636d8d1SFrederic Weisbecker * SRCU_STATE_SCAN2 : State set manually via rcu_seq_set_state() 42*3636d8d1SFrederic Weisbecker * Indicates we are flipping the readers 43*3636d8d1SFrederic Weisbecker * index and then scanning the readers on the 44*3636d8d1SFrederic Weisbecker * slot newly designated as inactive (again, 45*3636d8d1SFrederic Weisbecker * the number of pending readers that will use 46*3636d8d1SFrederic Weisbecker * this inactive index is bounded). 47*3636d8d1SFrederic Weisbecker * 48*3636d8d1SFrederic Weisbecker * RCU polled GP special control value: 49*3636d8d1SFrederic Weisbecker * 50*3636d8d1SFrederic Weisbecker * RCU_GET_STATE_COMPLETED : State value indicating an already-completed 51*3636d8d1SFrederic Weisbecker * polled GP has completed. This value covers 52*3636d8d1SFrederic Weisbecker * both the state and the counter of the 53*3636d8d1SFrederic Weisbecker * grace-period sequence number. 542e8c28c2SPaul E. McKenney */ 552e8c28c2SPaul E. McKenney 56f1ec57a4SPaul E. McKenney #define RCU_SEQ_CTR_SHIFT 2 57031aeee0SPaul E. McKenney #define RCU_SEQ_STATE_MASK ((1 << RCU_SEQ_CTR_SHIFT) - 1) 58031aeee0SPaul E. McKenney 59414c1238SPaul E. McKenney /* Low-order bit definition for polled grace-period APIs. */ 60414c1238SPaul E. McKenney #define RCU_GET_STATE_COMPLETED 0x1 61414c1238SPaul E. McKenney 62d9ab0e63SZhen Ni extern int sysctl_sched_rt_runtime; 63d9ab0e63SZhen Ni 64031aeee0SPaul E. McKenney /* 65031aeee0SPaul E. McKenney * Return the counter portion of a sequence number previously returned 66031aeee0SPaul E. McKenney * by rcu_seq_snap() or rcu_seq_current(). 67031aeee0SPaul E. McKenney */ 68031aeee0SPaul E. McKenney static inline unsigned long rcu_seq_ctr(unsigned long s) 69031aeee0SPaul E. McKenney { 70031aeee0SPaul E. McKenney return s >> RCU_SEQ_CTR_SHIFT; 71031aeee0SPaul E. McKenney } 72031aeee0SPaul E. McKenney 73031aeee0SPaul E. McKenney /* 74031aeee0SPaul E. McKenney * Return the state portion of a sequence number previously returned 75031aeee0SPaul E. McKenney * by rcu_seq_snap() or rcu_seq_current(). 76031aeee0SPaul E. McKenney */ 77031aeee0SPaul E. McKenney static inline int rcu_seq_state(unsigned long s) 78031aeee0SPaul E. McKenney { 79031aeee0SPaul E. McKenney return s & RCU_SEQ_STATE_MASK; 80031aeee0SPaul E. McKenney } 81031aeee0SPaul E. McKenney 8280a7956fSPaul E. McKenney /* 8380a7956fSPaul E. McKenney * Set the state portion of the pointed-to sequence number. 8480a7956fSPaul E. McKenney * The caller is responsible for preventing conflicting updates. 8580a7956fSPaul E. McKenney */ 8680a7956fSPaul E. McKenney static inline void rcu_seq_set_state(unsigned long *sp, int newstate) 8780a7956fSPaul E. McKenney { 8880a7956fSPaul E. McKenney WARN_ON_ONCE(newstate & ~RCU_SEQ_STATE_MASK); 8980a7956fSPaul E. McKenney WRITE_ONCE(*sp, (*sp & ~RCU_SEQ_STATE_MASK) + newstate); 9080a7956fSPaul E. McKenney } 9180a7956fSPaul E. McKenney 922e8c28c2SPaul E. McKenney /* Adjust sequence number for start of update-side operation. */ 932e8c28c2SPaul E. McKenney static inline void rcu_seq_start(unsigned long *sp) 942e8c28c2SPaul E. McKenney { 952e8c28c2SPaul E. McKenney WRITE_ONCE(*sp, *sp + 1); 962e8c28c2SPaul E. McKenney smp_mb(); /* Ensure update-side operation after counter increment. */ 97031aeee0SPaul E. McKenney WARN_ON_ONCE(rcu_seq_state(*sp) != 1); 982e8c28c2SPaul E. McKenney } 992e8c28c2SPaul E. McKenney 1009a414201SPaul E. McKenney /* Compute the end-of-grace-period value for the specified sequence number. */ 1019a414201SPaul E. McKenney static inline unsigned long rcu_seq_endval(unsigned long *sp) 1029a414201SPaul E. McKenney { 1039a414201SPaul E. McKenney return (*sp | RCU_SEQ_STATE_MASK) + 1; 1049a414201SPaul E. McKenney } 1059a414201SPaul E. McKenney 1062e8c28c2SPaul E. McKenney /* Adjust sequence number for end of update-side operation. */ 1072e8c28c2SPaul E. McKenney static inline void rcu_seq_end(unsigned long *sp) 1082e8c28c2SPaul E. McKenney { 1092e8c28c2SPaul E. McKenney smp_mb(); /* Ensure update-side operation before counter increment. */ 110031aeee0SPaul E. McKenney WARN_ON_ONCE(!rcu_seq_state(*sp)); 1119a414201SPaul E. McKenney WRITE_ONCE(*sp, rcu_seq_endval(sp)); 1122e8c28c2SPaul E. McKenney } 1132e8c28c2SPaul E. McKenney 1140d805a70SJoel Fernandes (Google) /* 1150d805a70SJoel Fernandes (Google) * rcu_seq_snap - Take a snapshot of the update side's sequence number. 1160d805a70SJoel Fernandes (Google) * 1170d805a70SJoel Fernandes (Google) * This function returns the earliest value of the grace-period sequence number 1180d805a70SJoel Fernandes (Google) * that will indicate that a full grace period has elapsed since the current 1190d805a70SJoel Fernandes (Google) * time. Once the grace-period sequence number has reached this value, it will 1200d805a70SJoel Fernandes (Google) * be safe to invoke all callbacks that have been registered prior to the 1210d805a70SJoel Fernandes (Google) * current time. This value is the current grace-period number plus two to the 1220d805a70SJoel Fernandes (Google) * power of the number of low-order bits reserved for state, then rounded up to 1230d805a70SJoel Fernandes (Google) * the next value in which the state bits are all zero. 1240d805a70SJoel Fernandes (Google) */ 1252e8c28c2SPaul E. McKenney static inline unsigned long rcu_seq_snap(unsigned long *sp) 1262e8c28c2SPaul E. McKenney { 1272e8c28c2SPaul E. McKenney unsigned long s; 1282e8c28c2SPaul E. McKenney 129031aeee0SPaul E. McKenney s = (READ_ONCE(*sp) + 2 * RCU_SEQ_STATE_MASK + 1) & ~RCU_SEQ_STATE_MASK; 1302e8c28c2SPaul E. McKenney smp_mb(); /* Above access must not bleed into critical section. */ 1312e8c28c2SPaul E. McKenney return s; 1322e8c28c2SPaul E. McKenney } 1332e8c28c2SPaul E. McKenney 1348660b7d8SPaul E. McKenney /* Return the current value the update side's sequence number, no ordering. */ 1358660b7d8SPaul E. McKenney static inline unsigned long rcu_seq_current(unsigned long *sp) 1368660b7d8SPaul E. McKenney { 1378660b7d8SPaul E. McKenney return READ_ONCE(*sp); 1388660b7d8SPaul E. McKenney } 1398660b7d8SPaul E. McKenney 1402e8c28c2SPaul E. McKenney /* 1412e3e5e55SPaul E. McKenney * Given a snapshot from rcu_seq_snap(), determine whether or not the 1422e3e5e55SPaul E. McKenney * corresponding update-side operation has started. 1432e3e5e55SPaul E. McKenney */ 1442e3e5e55SPaul E. McKenney static inline bool rcu_seq_started(unsigned long *sp, unsigned long s) 1452e3e5e55SPaul E. McKenney { 1462e3e5e55SPaul E. McKenney return ULONG_CMP_LT((s - 1) & ~RCU_SEQ_STATE_MASK, READ_ONCE(*sp)); 1472e3e5e55SPaul E. McKenney } 1482e3e5e55SPaul E. McKenney 1492e3e5e55SPaul E. McKenney /* 1502e8c28c2SPaul E. McKenney * Given a snapshot from rcu_seq_snap(), determine whether or not a 1512e8c28c2SPaul E. McKenney * full update-side operation has occurred. 1522e8c28c2SPaul E. McKenney */ 1532e8c28c2SPaul E. McKenney static inline bool rcu_seq_done(unsigned long *sp, unsigned long s) 1542e8c28c2SPaul E. McKenney { 1552e8c28c2SPaul E. McKenney return ULONG_CMP_GE(READ_ONCE(*sp), s); 1562e8c28c2SPaul E. McKenney } 1572e8c28c2SPaul E. McKenney 1584102adabSPaul E. McKenney /* 1592403e804SPaul E. McKenney * Given a snapshot from rcu_seq_snap(), determine whether or not a 1602403e804SPaul E. McKenney * full update-side operation has occurred, but do not allow the 1612403e804SPaul E. McKenney * (ULONG_MAX / 2) safety-factor/guard-band. 1622403e804SPaul E. McKenney */ 1632403e804SPaul E. McKenney static inline bool rcu_seq_done_exact(unsigned long *sp, unsigned long s) 1642403e804SPaul E. McKenney { 1652403e804SPaul E. McKenney unsigned long cur_s = READ_ONCE(*sp); 1662403e804SPaul E. McKenney 1672403e804SPaul E. McKenney return ULONG_CMP_GE(cur_s, s) || ULONG_CMP_LT(cur_s, s - (2 * RCU_SEQ_STATE_MASK + 1)); 1682403e804SPaul E. McKenney } 1692403e804SPaul E. McKenney 1702403e804SPaul E. McKenney /* 17167e14c1eSPaul E. McKenney * Has a grace period completed since the time the old gp_seq was collected? 17267e14c1eSPaul E. McKenney */ 17367e14c1eSPaul E. McKenney static inline bool rcu_seq_completed_gp(unsigned long old, unsigned long new) 17467e14c1eSPaul E. McKenney { 17567e14c1eSPaul E. McKenney return ULONG_CMP_LT(old, new & ~RCU_SEQ_STATE_MASK); 17667e14c1eSPaul E. McKenney } 17767e14c1eSPaul E. McKenney 17867e14c1eSPaul E. McKenney /* 17967e14c1eSPaul E. McKenney * Has a grace period started since the time the old gp_seq was collected? 18067e14c1eSPaul E. McKenney */ 18167e14c1eSPaul E. McKenney static inline bool rcu_seq_new_gp(unsigned long old, unsigned long new) 18267e14c1eSPaul E. McKenney { 18367e14c1eSPaul E. McKenney return ULONG_CMP_LT((old + RCU_SEQ_STATE_MASK) & ~RCU_SEQ_STATE_MASK, 18467e14c1eSPaul E. McKenney new); 18567e14c1eSPaul E. McKenney } 18667e14c1eSPaul E. McKenney 18767e14c1eSPaul E. McKenney /* 188d7219312SPaul E. McKenney * Roughly how many full grace periods have elapsed between the collection 189d7219312SPaul E. McKenney * of the two specified grace periods? 190d7219312SPaul E. McKenney */ 191d7219312SPaul E. McKenney static inline unsigned long rcu_seq_diff(unsigned long new, unsigned long old) 192d7219312SPaul E. McKenney { 1932ee5aca5SPaul E. McKenney unsigned long rnd_diff; 1942ee5aca5SPaul E. McKenney 1952ee5aca5SPaul E. McKenney if (old == new) 1962ee5aca5SPaul E. McKenney return 0; 1972ee5aca5SPaul E. McKenney /* 1982ee5aca5SPaul E. McKenney * Compute the number of grace periods (still shifted up), plus 1992ee5aca5SPaul E. McKenney * one if either of new and old is not an exact grace period. 2002ee5aca5SPaul E. McKenney */ 2012ee5aca5SPaul E. McKenney rnd_diff = (new & ~RCU_SEQ_STATE_MASK) - 2022ee5aca5SPaul E. McKenney ((old + RCU_SEQ_STATE_MASK) & ~RCU_SEQ_STATE_MASK) + 2032ee5aca5SPaul E. McKenney ((new & RCU_SEQ_STATE_MASK) || (old & RCU_SEQ_STATE_MASK)); 2042ee5aca5SPaul E. McKenney if (ULONG_CMP_GE(RCU_SEQ_STATE_MASK, rnd_diff)) 2052ee5aca5SPaul E. McKenney return 1; /* Definitely no grace period has elapsed. */ 2062ee5aca5SPaul E. McKenney return ((rnd_diff - RCU_SEQ_STATE_MASK - 1) >> RCU_SEQ_CTR_SHIFT) + 2; 207d7219312SPaul E. McKenney } 208d7219312SPaul E. McKenney 209d7219312SPaul E. McKenney /* 2104102adabSPaul E. McKenney * debug_rcu_head_queue()/debug_rcu_head_unqueue() are used internally 2117f87c036SPaul E. McKenney * by call_rcu() and rcu callback execution, and are therefore not part 2127f87c036SPaul E. McKenney * of the RCU API. These are in rcupdate.h because they are used by all 2137f87c036SPaul E. McKenney * RCU implementations. 2144102adabSPaul E. McKenney */ 2154102adabSPaul E. McKenney 2164102adabSPaul E. McKenney #ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD 2174102adabSPaul E. McKenney # define STATE_RCU_HEAD_READY 0 2184102adabSPaul E. McKenney # define STATE_RCU_HEAD_QUEUED 1 2194102adabSPaul E. McKenney 220f9e62f31SStephen Boyd extern const struct debug_obj_descr rcuhead_debug_descr; 2214102adabSPaul E. McKenney 2224102adabSPaul E. McKenney static inline int debug_rcu_head_queue(struct rcu_head *head) 2234102adabSPaul E. McKenney { 2244102adabSPaul E. McKenney int r1; 2254102adabSPaul E. McKenney 2264102adabSPaul E. McKenney r1 = debug_object_activate(head, &rcuhead_debug_descr); 2274102adabSPaul E. McKenney debug_object_active_state(head, &rcuhead_debug_descr, 2284102adabSPaul E. McKenney STATE_RCU_HEAD_READY, 2294102adabSPaul E. McKenney STATE_RCU_HEAD_QUEUED); 2304102adabSPaul E. McKenney return r1; 2314102adabSPaul E. McKenney } 2324102adabSPaul E. McKenney 2334102adabSPaul E. McKenney static inline void debug_rcu_head_unqueue(struct rcu_head *head) 2344102adabSPaul E. McKenney { 2354102adabSPaul E. McKenney debug_object_active_state(head, &rcuhead_debug_descr, 2364102adabSPaul E. McKenney STATE_RCU_HEAD_QUEUED, 2374102adabSPaul E. McKenney STATE_RCU_HEAD_READY); 2384102adabSPaul E. McKenney debug_object_deactivate(head, &rcuhead_debug_descr); 2394102adabSPaul E. McKenney } 2404102adabSPaul E. McKenney #else /* !CONFIG_DEBUG_OBJECTS_RCU_HEAD */ 2414102adabSPaul E. McKenney static inline int debug_rcu_head_queue(struct rcu_head *head) 2424102adabSPaul E. McKenney { 2434102adabSPaul E. McKenney return 0; 2444102adabSPaul E. McKenney } 2454102adabSPaul E. McKenney 2464102adabSPaul E. McKenney static inline void debug_rcu_head_unqueue(struct rcu_head *head) 2474102adabSPaul E. McKenney { 2484102adabSPaul E. McKenney } 2494102adabSPaul E. McKenney #endif /* #else !CONFIG_DEBUG_OBJECTS_RCU_HEAD */ 2504102adabSPaul E. McKenney 25158c53360SPaul E. McKenney extern int rcu_cpu_stall_suppress_at_boot; 25258c53360SPaul E. McKenney 25358c53360SPaul E. McKenney static inline bool rcu_stall_is_suppressed_at_boot(void) 25458c53360SPaul E. McKenney { 25558c53360SPaul E. McKenney return rcu_cpu_stall_suppress_at_boot && !rcu_inkernel_boot_has_ended(); 25658c53360SPaul E. McKenney } 25758c53360SPaul E. McKenney 2584102adabSPaul E. McKenney #ifdef CONFIG_RCU_STALL_COMMON 2594102adabSPaul E. McKenney 260cdc694b2SPaul E. McKenney extern int rcu_cpu_stall_ftrace_dump; 2614102adabSPaul E. McKenney extern int rcu_cpu_stall_suppress; 26210462d6fSPaul E. McKenney extern int rcu_cpu_stall_timeout; 26328b3ae42SUladzislau Rezki extern int rcu_exp_cpu_stall_timeout; 264be42f00bSZhen Lei extern int rcu_cpu_stall_cputime; 26592987fe8SPaul E. McKenney extern bool rcu_exp_stall_task_details __read_mostly; 2664102adabSPaul E. McKenney int rcu_jiffies_till_stall_check(void); 26728b3ae42SUladzislau Rezki int rcu_exp_jiffies_till_stall_check(void); 2684102adabSPaul E. McKenney 26958c53360SPaul E. McKenney static inline bool rcu_stall_is_suppressed(void) 27058c53360SPaul E. McKenney { 27158c53360SPaul E. McKenney return rcu_stall_is_suppressed_at_boot() || rcu_cpu_stall_suppress; 27258c53360SPaul E. McKenney } 27358c53360SPaul E. McKenney 274f22ce091SPaul E. McKenney #define rcu_ftrace_dump_stall_suppress() \ 275f22ce091SPaul E. McKenney do { \ 276f22ce091SPaul E. McKenney if (!rcu_cpu_stall_suppress) \ 277f22ce091SPaul E. McKenney rcu_cpu_stall_suppress = 3; \ 278f22ce091SPaul E. McKenney } while (0) 279f22ce091SPaul E. McKenney 280f22ce091SPaul E. McKenney #define rcu_ftrace_dump_stall_unsuppress() \ 281f22ce091SPaul E. McKenney do { \ 282f22ce091SPaul E. McKenney if (rcu_cpu_stall_suppress == 3) \ 283f22ce091SPaul E. McKenney rcu_cpu_stall_suppress = 0; \ 284f22ce091SPaul E. McKenney } while (0) 285f22ce091SPaul E. McKenney 286f22ce091SPaul E. McKenney #else /* #endif #ifdef CONFIG_RCU_STALL_COMMON */ 28758c53360SPaul E. McKenney 28858c53360SPaul E. McKenney static inline bool rcu_stall_is_suppressed(void) 28958c53360SPaul E. McKenney { 29058c53360SPaul E. McKenney return rcu_stall_is_suppressed_at_boot(); 29158c53360SPaul E. McKenney } 292f22ce091SPaul E. McKenney #define rcu_ftrace_dump_stall_suppress() 293f22ce091SPaul E. McKenney #define rcu_ftrace_dump_stall_unsuppress() 2944102adabSPaul E. McKenney #endif /* #ifdef CONFIG_RCU_STALL_COMMON */ 2954102adabSPaul E. McKenney 2964102adabSPaul E. McKenney /* 2974102adabSPaul E. McKenney * Strings used in tracepoints need to be exported via the 2984102adabSPaul E. McKenney * tracing system such that tools like perf and trace-cmd can 2994102adabSPaul E. McKenney * translate the string address pointers to actual text. 3004102adabSPaul E. McKenney */ 3014102adabSPaul E. McKenney #define TPS(x) tracepoint_string(x) 3024102adabSPaul E. McKenney 303b8989b76SPaul E. McKenney /* 304b8989b76SPaul E. McKenney * Dump the ftrace buffer, but only one time per callsite per boot. 305b8989b76SPaul E. McKenney */ 306b8989b76SPaul E. McKenney #define rcu_ftrace_dump(oops_dump_mode) \ 307b8989b76SPaul E. McKenney do { \ 308b8989b76SPaul E. McKenney static atomic_t ___rfd_beenhere = ATOMIC_INIT(0); \ 309b8989b76SPaul E. McKenney \ 310b8989b76SPaul E. McKenney if (!atomic_read(&___rfd_beenhere) && \ 31183b6ca1fSPaul E. McKenney !atomic_xchg(&___rfd_beenhere, 1)) { \ 31283b6ca1fSPaul E. McKenney tracing_off(); \ 313f22ce091SPaul E. McKenney rcu_ftrace_dump_stall_suppress(); \ 314b8989b76SPaul E. McKenney ftrace_dump(oops_dump_mode); \ 315f22ce091SPaul E. McKenney rcu_ftrace_dump_stall_unsuppress(); \ 31683b6ca1fSPaul E. McKenney } \ 317b8989b76SPaul E. McKenney } while (0) 318b8989b76SPaul E. McKenney 319aa23c6fbSPranith Kumar void rcu_early_boot_tests(void); 32052d7e48bSPaul E. McKenney void rcu_test_sync_prims(void); 321aa23c6fbSPranith Kumar 3225f6130faSLai Jiangshan /* 3235f6130faSLai Jiangshan * This function really isn't for public consumption, but RCU is special in 3245f6130faSLai Jiangshan * that context switches can allow the state machine to make progress. 3255f6130faSLai Jiangshan */ 3265f6130faSLai Jiangshan extern void resched_cpu(int cpu); 3275f6130faSLai Jiangshan 3280cd7e350SPaul E. McKenney #if !defined(CONFIG_TINY_RCU) 3292b34c43cSPaul E. McKenney 3302b34c43cSPaul E. McKenney #include <linux/rcu_node_tree.h> 3312b34c43cSPaul E. McKenney 3322b34c43cSPaul E. McKenney extern int rcu_num_lvls; 333e95d68d2SPaul E. McKenney extern int num_rcu_lvl[]; 3342b34c43cSPaul E. McKenney extern int rcu_num_nodes; 3352b34c43cSPaul E. McKenney static bool rcu_fanout_exact; 3362b34c43cSPaul E. McKenney static int rcu_fanout_leaf; 3372b34c43cSPaul E. McKenney 3382b34c43cSPaul E. McKenney /* 3392b34c43cSPaul E. McKenney * Compute the per-level fanout, either using the exact fanout specified 3402b34c43cSPaul E. McKenney * or balancing the tree, depending on the rcu_fanout_exact boot parameter. 3412b34c43cSPaul E. McKenney */ 3422b34c43cSPaul E. McKenney static inline void rcu_init_levelspread(int *levelspread, const int *levelcnt) 3432b34c43cSPaul E. McKenney { 3442b34c43cSPaul E. McKenney int i; 3452b34c43cSPaul E. McKenney 34636b5dae6SPaul E. McKenney for (i = 0; i < RCU_NUM_LVLS; i++) 34736b5dae6SPaul E. McKenney levelspread[i] = INT_MIN; 3482b34c43cSPaul E. McKenney if (rcu_fanout_exact) { 3492b34c43cSPaul E. McKenney levelspread[rcu_num_lvls - 1] = rcu_fanout_leaf; 3502b34c43cSPaul E. McKenney for (i = rcu_num_lvls - 2; i >= 0; i--) 3512b34c43cSPaul E. McKenney levelspread[i] = RCU_FANOUT; 3522b34c43cSPaul E. McKenney } else { 3532b34c43cSPaul E. McKenney int ccur; 3542b34c43cSPaul E. McKenney int cprv; 3552b34c43cSPaul E. McKenney 3562b34c43cSPaul E. McKenney cprv = nr_cpu_ids; 3572b34c43cSPaul E. McKenney for (i = rcu_num_lvls - 1; i >= 0; i--) { 3582b34c43cSPaul E. McKenney ccur = levelcnt[i]; 3592b34c43cSPaul E. McKenney levelspread[i] = (cprv + ccur - 1) / ccur; 3602b34c43cSPaul E. McKenney cprv = ccur; 3612b34c43cSPaul E. McKenney } 3622b34c43cSPaul E. McKenney } 3632b34c43cSPaul E. McKenney } 3642b34c43cSPaul E. McKenney 365b5befe84SFrederic Weisbecker extern void rcu_init_geometry(void); 366b5befe84SFrederic Weisbecker 3677f87c036SPaul E. McKenney /* Returns a pointer to the first leaf rcu_node structure. */ 368aedf4ba9SPaul E. McKenney #define rcu_first_leaf_node() (rcu_state.level[rcu_num_lvls - 1]) 3695b4c11d5SPaul E. McKenney 3705b4c11d5SPaul E. McKenney /* Is this rcu_node a leaf? */ 3715b4c11d5SPaul E. McKenney #define rcu_is_leaf_node(rnp) ((rnp)->level == rcu_num_lvls - 1) 3725b4c11d5SPaul E. McKenney 3735257514dSPaul E. McKenney /* Is this rcu_node the last leaf? */ 374aedf4ba9SPaul E. McKenney #define rcu_is_last_leaf_node(rnp) ((rnp) == &rcu_state.node[rcu_num_nodes - 1]) 3755257514dSPaul E. McKenney 376efbe451dSPaul E. McKenney /* 377aedf4ba9SPaul E. McKenney * Do a full breadth-first scan of the {s,}rcu_node structures for the 3787f87c036SPaul E. McKenney * specified state structure (for SRCU) or the only rcu_state structure 3797f87c036SPaul E. McKenney * (for RCU). 380efbe451dSPaul E. McKenney */ 381aedf4ba9SPaul E. McKenney #define srcu_for_each_node_breadth_first(sp, rnp) \ 382aedf4ba9SPaul E. McKenney for ((rnp) = &(sp)->node[0]; \ 383aedf4ba9SPaul E. McKenney (rnp) < &(sp)->node[rcu_num_nodes]; (rnp)++) 384aedf4ba9SPaul E. McKenney #define rcu_for_each_node_breadth_first(rnp) \ 385aedf4ba9SPaul E. McKenney srcu_for_each_node_breadth_first(&rcu_state, rnp) 386efbe451dSPaul E. McKenney 387efbe451dSPaul E. McKenney /* 3887f87c036SPaul E. McKenney * Scan the leaves of the rcu_node hierarchy for the rcu_state structure. 3897f87c036SPaul E. McKenney * Note that if there is a singleton rcu_node tree with but one rcu_node 3907f87c036SPaul E. McKenney * structure, this loop -will- visit the rcu_node structure. It is still 3917f87c036SPaul E. McKenney * a leaf node, even if it is also the root node. 392efbe451dSPaul E. McKenney */ 393aedf4ba9SPaul E. McKenney #define rcu_for_each_leaf_node(rnp) \ 394aedf4ba9SPaul E. McKenney for ((rnp) = rcu_first_leaf_node(); \ 395aedf4ba9SPaul E. McKenney (rnp) < &rcu_state.node[rcu_num_nodes]; (rnp)++) 396efbe451dSPaul E. McKenney 397efbe451dSPaul E. McKenney /* 398efbe451dSPaul E. McKenney * Iterate over all possible CPUs in a leaf RCU node. 399efbe451dSPaul E. McKenney */ 400efbe451dSPaul E. McKenney #define for_each_leaf_node_possible_cpu(rnp, cpu) \ 40182dd8419SPaul E. McKenney for (WARN_ON_ONCE(!rcu_is_leaf_node(rnp)), \ 40282dd8419SPaul E. McKenney (cpu) = cpumask_next((rnp)->grplo - 1, cpu_possible_mask); \ 40365963d24SPaul E. McKenney (cpu) <= rnp->grphi; \ 40465963d24SPaul E. McKenney (cpu) = cpumask_next((cpu), cpu_possible_mask)) 40565963d24SPaul E. McKenney 40665963d24SPaul E. McKenney /* 40765963d24SPaul E. McKenney * Iterate over all CPUs in a leaf RCU node's specified mask. 40865963d24SPaul E. McKenney */ 40965963d24SPaul E. McKenney #define rcu_find_next_bit(rnp, cpu, mask) \ 41065963d24SPaul E. McKenney ((rnp)->grplo + find_next_bit(&(mask), BITS_PER_LONG, (cpu))) 41165963d24SPaul E. McKenney #define for_each_leaf_node_cpu_mask(rnp, cpu, mask) \ 41282dd8419SPaul E. McKenney for (WARN_ON_ONCE(!rcu_is_leaf_node(rnp)), \ 41382dd8419SPaul E. McKenney (cpu) = rcu_find_next_bit((rnp), 0, (mask)); \ 41465963d24SPaul E. McKenney (cpu) <= rnp->grphi; \ 41565963d24SPaul E. McKenney (cpu) = rcu_find_next_bit((rnp), (cpu) + 1 - (rnp->grplo), (mask))) 416efbe451dSPaul E. McKenney 4170cd7e350SPaul E. McKenney #endif /* !defined(CONFIG_TINY_RCU) */ 4180cd7e350SPaul E. McKenney 4190cd7e350SPaul E. McKenney #if !defined(CONFIG_TINY_RCU) || defined(CONFIG_TASKS_RCU_GENERIC) 4200cd7e350SPaul E. McKenney 42183d40bd3SPaul E. McKenney /* 42283d40bd3SPaul E. McKenney * Wrappers for the rcu_node::lock acquire and release. 42383d40bd3SPaul E. McKenney * 42483d40bd3SPaul E. McKenney * Because the rcu_nodes form a tree, the tree traversal locking will observe 42583d40bd3SPaul E. McKenney * different lock values, this in turn means that an UNLOCK of one level 42683d40bd3SPaul E. McKenney * followed by a LOCK of another level does not imply a full memory barrier; 42783d40bd3SPaul E. McKenney * and most importantly transitivity is lost. 42883d40bd3SPaul E. McKenney * 42983d40bd3SPaul E. McKenney * In order to restore full ordering between tree levels, augment the regular 43083d40bd3SPaul E. McKenney * lock acquire functions with smp_mb__after_unlock_lock(). 43183d40bd3SPaul E. McKenney * 43283d40bd3SPaul E. McKenney * As ->lock of struct rcu_node is a __private field, therefore one should use 43383d40bd3SPaul E. McKenney * these wrappers rather than directly call raw_spin_{lock,unlock}* on ->lock. 43483d40bd3SPaul E. McKenney */ 43583d40bd3SPaul E. McKenney #define raw_spin_lock_rcu_node(p) \ 43683d40bd3SPaul E. McKenney do { \ 43783d40bd3SPaul E. McKenney raw_spin_lock(&ACCESS_PRIVATE(p, lock)); \ 43883d40bd3SPaul E. McKenney smp_mb__after_unlock_lock(); \ 43983d40bd3SPaul E. McKenney } while (0) 44083d40bd3SPaul E. McKenney 4417dffe017SPaul E. McKenney #define raw_spin_unlock_rcu_node(p) \ 4427dffe017SPaul E. McKenney do { \ 4437dffe017SPaul E. McKenney lockdep_assert_irqs_disabled(); \ 4447dffe017SPaul E. McKenney raw_spin_unlock(&ACCESS_PRIVATE(p, lock)); \ 4457dffe017SPaul E. McKenney } while (0) 44683d40bd3SPaul E. McKenney 44783d40bd3SPaul E. McKenney #define raw_spin_lock_irq_rcu_node(p) \ 44883d40bd3SPaul E. McKenney do { \ 44983d40bd3SPaul E. McKenney raw_spin_lock_irq(&ACCESS_PRIVATE(p, lock)); \ 45083d40bd3SPaul E. McKenney smp_mb__after_unlock_lock(); \ 45183d40bd3SPaul E. McKenney } while (0) 45283d40bd3SPaul E. McKenney 45383d40bd3SPaul E. McKenney #define raw_spin_unlock_irq_rcu_node(p) \ 4547dffe017SPaul E. McKenney do { \ 4557dffe017SPaul E. McKenney lockdep_assert_irqs_disabled(); \ 4567dffe017SPaul E. McKenney raw_spin_unlock_irq(&ACCESS_PRIVATE(p, lock)); \ 4577dffe017SPaul E. McKenney } while (0) 45883d40bd3SPaul E. McKenney 4594e4bea74SPaul E. McKenney #define raw_spin_lock_irqsave_rcu_node(p, flags) \ 46083d40bd3SPaul E. McKenney do { \ 4614e4bea74SPaul E. McKenney raw_spin_lock_irqsave(&ACCESS_PRIVATE(p, lock), flags); \ 46283d40bd3SPaul E. McKenney smp_mb__after_unlock_lock(); \ 46383d40bd3SPaul E. McKenney } while (0) 46483d40bd3SPaul E. McKenney 4654e4bea74SPaul E. McKenney #define raw_spin_unlock_irqrestore_rcu_node(p, flags) \ 4667dffe017SPaul E. McKenney do { \ 4677dffe017SPaul E. McKenney lockdep_assert_irqs_disabled(); \ 4687dffe017SPaul E. McKenney raw_spin_unlock_irqrestore(&ACCESS_PRIVATE(p, lock), flags); \ 4697dffe017SPaul E. McKenney } while (0) 47083d40bd3SPaul E. McKenney 47183d40bd3SPaul E. McKenney #define raw_spin_trylock_rcu_node(p) \ 47283d40bd3SPaul E. McKenney ({ \ 47383d40bd3SPaul E. McKenney bool ___locked = raw_spin_trylock(&ACCESS_PRIVATE(p, lock)); \ 47483d40bd3SPaul E. McKenney \ 47583d40bd3SPaul E. McKenney if (___locked) \ 47683d40bd3SPaul E. McKenney smp_mb__after_unlock_lock(); \ 47783d40bd3SPaul E. McKenney ___locked; \ 47883d40bd3SPaul E. McKenney }) 47983d40bd3SPaul E. McKenney 480a32e01eeSMatthew Wilcox #define raw_lockdep_assert_held_rcu_node(p) \ 481a32e01eeSMatthew Wilcox lockdep_assert_held(&ACCESS_PRIVATE(p, lock)) 482a32e01eeSMatthew Wilcox 4830cd7e350SPaul E. McKenney #endif // #if !defined(CONFIG_TINY_RCU) || defined(CONFIG_TASKS_RCU_GENERIC) 4842b34c43cSPaul E. McKenney 48525c36329SPaul E. McKenney #ifdef CONFIG_TINY_RCU 48625c36329SPaul E. McKenney /* Tiny RCU doesn't expedite, as its purpose in life is instead to be tiny. */ 4877414fac0SPaul E. McKenney static inline bool rcu_gp_is_normal(void) { return true; } 4887414fac0SPaul E. McKenney static inline bool rcu_gp_is_expedited(void) { return false; } 4896efdda8bSJoel Fernandes (Google) static inline bool rcu_async_should_hurry(void) { return false; } 4907414fac0SPaul E. McKenney static inline void rcu_expedite_gp(void) { } 4917414fac0SPaul E. McKenney static inline void rcu_unexpedite_gp(void) { } 4926efdda8bSJoel Fernandes (Google) static inline void rcu_async_hurry(void) { } 4936efdda8bSJoel Fernandes (Google) static inline void rcu_async_relax(void) { } 494bfbd767dSPaul E. McKenney static inline void rcu_request_urgent_qs_task(struct task_struct *t) { } 49525c36329SPaul E. McKenney #else /* #ifdef CONFIG_TINY_RCU */ 49625c36329SPaul E. McKenney bool rcu_gp_is_normal(void); /* Internal RCU use. */ 49725c36329SPaul E. McKenney bool rcu_gp_is_expedited(void); /* Internal RCU use. */ 4986efdda8bSJoel Fernandes (Google) bool rcu_async_should_hurry(void); /* Internal RCU use. */ 49925c36329SPaul E. McKenney void rcu_expedite_gp(void); 50025c36329SPaul E. McKenney void rcu_unexpedite_gp(void); 5016efdda8bSJoel Fernandes (Google) void rcu_async_hurry(void); 5026efdda8bSJoel Fernandes (Google) void rcu_async_relax(void); 50325c36329SPaul E. McKenney void rcupdate_announce_bootup_oddness(void); 504474d0997SPaul E. McKenney #ifdef CONFIG_TASKS_RCU_GENERIC 505e21408ceSPaul E. McKenney void show_rcu_tasks_gp_kthreads(void); 506474d0997SPaul E. McKenney #else /* #ifdef CONFIG_TASKS_RCU_GENERIC */ 507474d0997SPaul E. McKenney static inline void show_rcu_tasks_gp_kthreads(void) {} 508474d0997SPaul E. McKenney #endif /* #else #ifdef CONFIG_TASKS_RCU_GENERIC */ 509bfbd767dSPaul E. McKenney void rcu_request_urgent_qs_task(struct task_struct *t); 51025c36329SPaul E. McKenney #endif /* #else #ifdef CONFIG_TINY_RCU */ 51125c36329SPaul E. McKenney 51282118249SPaul E. McKenney #define RCU_SCHEDULER_INACTIVE 0 51382118249SPaul E. McKenney #define RCU_SCHEDULER_INIT 1 51482118249SPaul E. McKenney #define RCU_SCHEDULER_RUNNING 2 51582118249SPaul E. McKenney 516cad7b389SPaul E. McKenney enum rcutorture_type { 517cad7b389SPaul E. McKenney RCU_FLAVOR, 518cad7b389SPaul E. McKenney RCU_TASKS_FLAVOR, 5193d6e43c7SPaul E. McKenney RCU_TASKS_RUDE_FLAVOR, 520c1a76c0bSPaul E. McKenney RCU_TASKS_TRACING_FLAVOR, 521c682db55SPaul E. McKenney RCU_TRIVIAL_FLAVOR, 522cad7b389SPaul E. McKenney SRCU_FLAVOR, 523cad7b389SPaul E. McKenney INVALID_RCU_FLAVOR 524cad7b389SPaul E. McKenney }; 525cad7b389SPaul E. McKenney 5263cb278e7SJoel Fernandes (Google) #if defined(CONFIG_RCU_LAZY) 5273cb278e7SJoel Fernandes (Google) unsigned long rcu_lazy_get_jiffies_till_flush(void); 5283cb278e7SJoel Fernandes (Google) void rcu_lazy_set_jiffies_till_flush(unsigned long j); 5293cb278e7SJoel Fernandes (Google) #else 5303cb278e7SJoel Fernandes (Google) static inline unsigned long rcu_lazy_get_jiffies_till_flush(void) { return 0; } 5313cb278e7SJoel Fernandes (Google) static inline void rcu_lazy_set_jiffies_till_flush(unsigned long j) { } 5323cb278e7SJoel Fernandes (Google) #endif 5333cb278e7SJoel Fernandes (Google) 534b3e627d3SLai Jiangshan #if defined(CONFIG_TREE_RCU) 535cad7b389SPaul E. McKenney void rcutorture_get_gp_data(enum rcutorture_type test_type, int *flags, 536aebc8264SPaul E. McKenney unsigned long *gp_seq); 537cad7b389SPaul E. McKenney void do_trace_rcu_torture_read(const char *rcutorturename, 538cad7b389SPaul E. McKenney struct rcu_head *rhp, 539cad7b389SPaul E. McKenney unsigned long secs, 540cad7b389SPaul E. McKenney unsigned long c_old, 541cad7b389SPaul E. McKenney unsigned long c); 54255b2dcf5SPaul E. McKenney void rcu_gp_set_torture_wait(int duration); 543cad7b389SPaul E. McKenney #else 544cad7b389SPaul E. McKenney static inline void rcutorture_get_gp_data(enum rcutorture_type test_type, 545aebc8264SPaul E. McKenney int *flags, unsigned long *gp_seq) 546cad7b389SPaul E. McKenney { 547cad7b389SPaul E. McKenney *flags = 0; 548aebc8264SPaul E. McKenney *gp_seq = 0; 549cad7b389SPaul E. McKenney } 550cad7b389SPaul E. McKenney #ifdef CONFIG_RCU_TRACE 551cad7b389SPaul E. McKenney void do_trace_rcu_torture_read(const char *rcutorturename, 552cad7b389SPaul E. McKenney struct rcu_head *rhp, 553cad7b389SPaul E. McKenney unsigned long secs, 554cad7b389SPaul E. McKenney unsigned long c_old, 555cad7b389SPaul E. McKenney unsigned long c); 556cad7b389SPaul E. McKenney #else 557cad7b389SPaul E. McKenney #define do_trace_rcu_torture_read(rcutorturename, rhp, secs, c_old, c) \ 558cad7b389SPaul E. McKenney do { } while (0) 559cad7b389SPaul E. McKenney #endif 56055b2dcf5SPaul E. McKenney static inline void rcu_gp_set_torture_wait(int duration) { } 561cad7b389SPaul E. McKenney #endif 562cad7b389SPaul E. McKenney 563c682db55SPaul E. McKenney #if IS_ENABLED(CONFIG_RCU_TORTURE_TEST) || IS_MODULE(CONFIG_RCU_TORTURE_TEST) 564c682db55SPaul E. McKenney long rcutorture_sched_setaffinity(pid_t pid, const struct cpumask *in_mask); 565c682db55SPaul E. McKenney #endif 566c682db55SPaul E. McKenney 567cad7b389SPaul E. McKenney #ifdef CONFIG_TINY_SRCU 568cad7b389SPaul E. McKenney 569cad7b389SPaul E. McKenney static inline void srcutorture_get_gp_data(enum rcutorture_type test_type, 570cad7b389SPaul E. McKenney struct srcu_struct *sp, int *flags, 571aebc8264SPaul E. McKenney unsigned long *gp_seq) 572cad7b389SPaul E. McKenney { 573cad7b389SPaul E. McKenney if (test_type != SRCU_FLAVOR) 574cad7b389SPaul E. McKenney return; 575cad7b389SPaul E. McKenney *flags = 0; 576aebc8264SPaul E. McKenney *gp_seq = sp->srcu_idx; 577cad7b389SPaul E. McKenney } 578cad7b389SPaul E. McKenney 579cad7b389SPaul E. McKenney #elif defined(CONFIG_TREE_SRCU) 580cad7b389SPaul E. McKenney 581cad7b389SPaul E. McKenney void srcutorture_get_gp_data(enum rcutorture_type test_type, 582cad7b389SPaul E. McKenney struct srcu_struct *sp, int *flags, 583aebc8264SPaul E. McKenney unsigned long *gp_seq); 584cad7b389SPaul E. McKenney 585cad7b389SPaul E. McKenney #endif 586cad7b389SPaul E. McKenney 587e3c8d51eSPaul E. McKenney #ifdef CONFIG_TINY_RCU 5887d0c9c50SPaul E. McKenney static inline bool rcu_dynticks_zero_in_eqs(int cpu, int *vp) { return false; } 58917ef2fe9SPaul E. McKenney static inline unsigned long rcu_get_gp_seq(void) { return 0; } 5907414fac0SPaul E. McKenney static inline unsigned long rcu_exp_batches_completed(void) { return 0; } 5917414fac0SPaul E. McKenney static inline unsigned long 5927414fac0SPaul E. McKenney srcu_batches_completed(struct srcu_struct *sp) { return 0; } 5937414fac0SPaul E. McKenney static inline void rcu_force_quiescent_state(void) { } 5940260b92eSPaul E. McKenney static inline bool rcu_check_boost_fail(unsigned long gp_state, int *cpup) { return true; } 5957414fac0SPaul E. McKenney static inline void show_rcu_gp_kthreads(void) { } 5964babd855SJoel Fernandes (Google) static inline int rcu_get_gp_kthreads_prio(void) { return 0; } 597e0aff973SPaul E. McKenney static inline void rcu_fwd_progress_check(unsigned long j) { } 59899d6a2acSPaul E. McKenney static inline void rcu_gp_slow_register(atomic_t *rgssp) { } 59999d6a2acSPaul E. McKenney static inline void rcu_gp_slow_unregister(atomic_t *rgssp) { } 600e3c8d51eSPaul E. McKenney #else /* #ifdef CONFIG_TINY_RCU */ 6017d0c9c50SPaul E. McKenney bool rcu_dynticks_zero_in_eqs(int cpu, int *vp); 60217ef2fe9SPaul E. McKenney unsigned long rcu_get_gp_seq(void); 603e3c8d51eSPaul E. McKenney unsigned long rcu_exp_batches_completed(void); 6045a0465e1SPaul E. McKenney unsigned long srcu_batches_completed(struct srcu_struct *sp); 6050260b92eSPaul E. McKenney bool rcu_check_boost_fail(unsigned long gp_state, int *cpup); 606e3c8d51eSPaul E. McKenney void show_rcu_gp_kthreads(void); 6074babd855SJoel Fernandes (Google) int rcu_get_gp_kthreads_prio(void); 608e0aff973SPaul E. McKenney void rcu_fwd_progress_check(unsigned long j); 609e3c8d51eSPaul E. McKenney void rcu_force_quiescent_state(void); 610ad7c946bSPaul E. McKenney extern struct workqueue_struct *rcu_gp_wq; 6119621fbeeSKalesh Singh #ifdef CONFIG_RCU_EXP_KTHREAD 6129621fbeeSKalesh Singh extern struct kthread_worker *rcu_exp_gp_kworker; 6139621fbeeSKalesh Singh extern struct kthread_worker *rcu_exp_par_gp_kworker; 6149621fbeeSKalesh Singh #else /* !CONFIG_RCU_EXP_KTHREAD */ 61525f3d7efSPaul E. McKenney extern struct workqueue_struct *rcu_par_gp_wq; 6169621fbeeSKalesh Singh #endif /* CONFIG_RCU_EXP_KTHREAD */ 61799d6a2acSPaul E. McKenney void rcu_gp_slow_register(atomic_t *rgssp); 61899d6a2acSPaul E. McKenney void rcu_gp_slow_unregister(atomic_t *rgssp); 619e3c8d51eSPaul E. McKenney #endif /* #else #ifdef CONFIG_TINY_RCU */ 620e3c8d51eSPaul E. McKenney 62144c65ff2SPaul E. McKenney #ifdef CONFIG_RCU_NOCB_CPU 6225ab7ab83SPaul E. McKenney void rcu_bind_current_to_nocb(void); 6233d54f798SPaul E. McKenney #else 6245ab7ab83SPaul E. McKenney static inline void rcu_bind_current_to_nocb(void) { } 6253d54f798SPaul E. McKenney #endif 6263d54f798SPaul E. McKenney 62727c0f144SPaul E. McKenney #if !defined(CONFIG_TINY_RCU) && defined(CONFIG_TASKS_RCU) 62827c0f144SPaul E. McKenney void show_rcu_tasks_classic_gp_kthread(void); 62927c0f144SPaul E. McKenney #else 63027c0f144SPaul E. McKenney static inline void show_rcu_tasks_classic_gp_kthread(void) {} 63127c0f144SPaul E. McKenney #endif 63227c0f144SPaul E. McKenney #if !defined(CONFIG_TINY_RCU) && defined(CONFIG_TASKS_RUDE_RCU) 63327c0f144SPaul E. McKenney void show_rcu_tasks_rude_gp_kthread(void); 63427c0f144SPaul E. McKenney #else 63527c0f144SPaul E. McKenney static inline void show_rcu_tasks_rude_gp_kthread(void) {} 63627c0f144SPaul E. McKenney #endif 63727c0f144SPaul E. McKenney #if !defined(CONFIG_TINY_RCU) && defined(CONFIG_TASKS_TRACE_RCU) 63827c0f144SPaul E. McKenney void show_rcu_tasks_trace_gp_kthread(void); 63927c0f144SPaul E. McKenney #else 64027c0f144SPaul E. McKenney static inline void show_rcu_tasks_trace_gp_kthread(void) {} 64127c0f144SPaul E. McKenney #endif 64227c0f144SPaul E. McKenney 6434102adabSPaul E. McKenney #endif /* __LINUX_RCU_H */ 644