38 #define MAX_RCU_LVLS 4
39 #define RCU_FANOUT_1 (CONFIG_RCU_FANOUT_LEAF)
40 #define RCU_FANOUT_2 (RCU_FANOUT_1 * CONFIG_RCU_FANOUT)
41 #define RCU_FANOUT_3 (RCU_FANOUT_2 * CONFIG_RCU_FANOUT)
42 #define RCU_FANOUT_4 (RCU_FANOUT_3 * CONFIG_RCU_FANOUT)
44 #if NR_CPUS <= RCU_FANOUT_1
45 # define RCU_NUM_LVLS 1
46 # define NUM_RCU_LVL_0 1
47 # define NUM_RCU_LVL_1 (NR_CPUS)
48 # define NUM_RCU_LVL_2 0
49 # define NUM_RCU_LVL_3 0
50 # define NUM_RCU_LVL_4 0
51 #elif NR_CPUS <= RCU_FANOUT_2
52 # define RCU_NUM_LVLS 2
53 # define NUM_RCU_LVL_0 1
54 # define NUM_RCU_LVL_1 DIV_ROUND_UP(NR_CPUS, RCU_FANOUT_1)
55 # define NUM_RCU_LVL_2 (NR_CPUS)
56 # define NUM_RCU_LVL_3 0
57 # define NUM_RCU_LVL_4 0
58 #elif NR_CPUS <= RCU_FANOUT_3
59 # define RCU_NUM_LVLS 3
60 # define NUM_RCU_LVL_0 1
61 # define NUM_RCU_LVL_1 DIV_ROUND_UP(NR_CPUS, RCU_FANOUT_2)
62 # define NUM_RCU_LVL_2 DIV_ROUND_UP(NR_CPUS, RCU_FANOUT_1)
63 # define NUM_RCU_LVL_3 (NR_CPUS)
64 # define NUM_RCU_LVL_4 0
65 #elif NR_CPUS <= RCU_FANOUT_4
66 # define RCU_NUM_LVLS 4
67 # define NUM_RCU_LVL_0 1
68 # define NUM_RCU_LVL_1 DIV_ROUND_UP(NR_CPUS, RCU_FANOUT_3)
69 # define NUM_RCU_LVL_2 DIV_ROUND_UP(NR_CPUS, RCU_FANOUT_2)
70 # define NUM_RCU_LVL_3 DIV_ROUND_UP(NR_CPUS, RCU_FANOUT_1)
71 # define NUM_RCU_LVL_4 (NR_CPUS)
73 # error "CONFIG_RCU_FANOUT insufficient for NR_CPUS"
76 #define RCU_SUM (NUM_RCU_LVL_0 + NUM_RCU_LVL_1 + NUM_RCU_LVL_2 + NUM_RCU_LVL_3 + NUM_RCU_LVL_4)
77 #define NUM_RCU_NODES (RCU_SUM - NR_CPUS)
90 #ifdef CONFIG_RCU_FAST_NO_HZ
92 unsigned long dyntick_holdoff;
96 unsigned long idle_gp_timer_expires;
99 unsigned long nonlazy_posted;
101 unsigned long nonlazy_posted_snap;
103 int tick_nohz_enabled_snap;
105 #ifdef CONFIG_RCU_USER_QS
112 #define RCU_KTHREAD_STOPPED 0
113 #define RCU_KTHREAD_RUNNING 1
114 #define RCU_KTHREAD_WAITING 2
115 #define RCU_KTHREAD_OFFCPU 3
116 #define RCU_KTHREAD_YIELDING 4
117 #define RCU_KTHREAD_MAX 4
167 #ifdef CONFIG_RCU_BOOST
176 unsigned long boost_time;
181 unsigned int boost_kthread_status;
183 unsigned long n_tasks_boosted;
185 unsigned long n_exp_boosts;
187 unsigned long n_normal_boosts;
189 unsigned long n_balk_blkd_tasks;
191 unsigned long n_balk_exp_gp_tasks;
193 unsigned long n_balk_boost_tasks;
195 unsigned long n_balk_notblocked;
197 unsigned long n_balk_notyet;
199 unsigned long n_balk_nos;
210 #define rcu_for_each_node_breadth_first(rsp, rnp) \
211 for ((rnp) = &(rsp)->node[0]; \
212 (rnp) < &(rsp)->node[rcu_num_nodes]; (rnp)++)
219 #define rcu_for_each_nonleaf_node_breadth_first(rsp, rnp) \
220 for ((rnp) = &(rsp)->node[0]; \
221 (rnp) < (rsp)->level[rcu_num_lvls - 1]; (rnp)++)
229 #define rcu_for_each_leaf_node(rsp, rnp) \
230 for ((rnp) = (rsp)->level[rcu_num_lvls - 1]; \
231 (rnp) < &(rsp)->node[rcu_num_nodes]; (rnp)++)
234 #define RCU_DONE_TAIL 0
235 #define RCU_WAIT_TAIL 1
236 #define RCU_NEXT_READY_TAIL 2
237 #define RCU_NEXT_TAIL 3
238 #define RCU_NEXT_SIZE 4
253 #ifdef CONFIG_RCU_CPU_STALL_INFO
254 unsigned long ticks_this_gp;
316 #ifdef CONFIG_RCU_FAST_NO_HZ
325 #define RCU_GP_IDLE 0
326 #define RCU_GP_INIT 1
327 #define RCU_SAVE_DYNTICK 2
328 #define RCU_FORCE_QS 3
329 #define RCU_SIGNAL_INIT RCU_SAVE_DYNTICK
331 #define RCU_JIFFIES_TILL_FORCE_QS 3
333 #ifdef CONFIG_PROVE_RCU
334 #define RCU_STALL_DELAY_DELTA (5 * HZ)
336 #define RCU_STALL_DELAY_DELTA 0
338 #define RCU_STALL_RAT_DELAY 2
343 #define rcu_wait(cond) \
346 set_current_state(TASK_INTERRUPTIBLE); \
351 __set_current_state(TASK_RUNNING); \
427 #define RCU_GP_FLAG_INIT 0x1
428 #define RCU_GP_FLAG_FQS 0x2
431 #define for_each_rcu_flavor(rsp) \
432 list_for_each_entry((rsp), &rcu_struct_flavors, flavors)
436 #define RCU_OFL_TASKS_NORM_GP 0x1
438 #define RCU_OFL_TASKS_EXP_GP 0x2
450 #ifdef CONFIG_TREE_PREEMPT_RCU
451 extern struct rcu_state rcu_preempt_state;
455 #ifdef CONFIG_RCU_BOOST
462 #ifndef RCU_TREE_NONCORE
465 static void rcu_bootup_announce(
void);
468 static int rcu_preempt_blocked_readers_cgp(
struct rcu_node *rnp);
469 #ifdef CONFIG_HOTPLUG_CPU
470 static void rcu_report_unblock_qs_rnp(
struct rcu_node *rnp,
471 unsigned long flags);
473 static void rcu_print_detail_task_stall(
struct rcu_state *
rsp);
474 static int rcu_print_task_stall(
struct rcu_node *rnp);
475 static void rcu_preempt_check_blocked_tasks(
struct rcu_node *rnp);
476 #ifdef CONFIG_HOTPLUG_CPU
477 static int rcu_preempt_offline_tasks(
struct rcu_state *
rsp,
481 static void rcu_preempt_check_callbacks(
int cpu);
483 #if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_TREE_PREEMPT_RCU)
487 static void __init __rcu_init_preempt(
void);
488 static void rcu_initiate_boost(
struct rcu_node *rnp,
unsigned long flags);
489 static void rcu_preempt_boost_start_gp(
struct rcu_node *rnp);
490 static void invoke_rcu_callbacks_kthread(
void);
491 static bool rcu_is_callbacks_kthread(
void);
492 #ifdef CONFIG_RCU_BOOST
493 static void rcu_preempt_do_callbacks(
void);
498 static void rcu_prepare_for_idle_init(
int cpu);
499 static void rcu_cleanup_after_idle(
int cpu);
500 static void rcu_prepare_for_idle(
int cpu);
501 static void rcu_idle_count_callbacks_posted(
void);
502 static void print_cpu_stall_info_begin(
void);
504 static void print_cpu_stall_info_end(
void);
505 static void zero_cpu_stall_ticks(
struct rcu_data *
rdp);
506 static void increment_cpu_stall_ticks(
void);