aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/rcutree.c53
-rw-r--r--kernel/rcutree.h12
-rw-r--r--kernel/rcutree_plugin.h116
3 files changed, 37 insertions, 144 deletions
diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 5376a156be8a..b61c3ffc80e9 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -84,6 +84,7 @@ struct rcu_state rcu_bh_state = RCU_STATE_INITIALIZER(rcu_bh, call_rcu_bh);
84DEFINE_PER_CPU(struct rcu_data, rcu_bh_data); 84DEFINE_PER_CPU(struct rcu_data, rcu_bh_data);
85 85
86static struct rcu_state *rcu_state; 86static struct rcu_state *rcu_state;
87LIST_HEAD(rcu_struct_flavors);
87 88
88/* Increase (but not decrease) the CONFIG_RCU_FANOUT_LEAF at boot time. */ 89/* Increase (but not decrease) the CONFIG_RCU_FANOUT_LEAF at boot time. */
89static int rcu_fanout_leaf = CONFIG_RCU_FANOUT_LEAF; 90static int rcu_fanout_leaf = CONFIG_RCU_FANOUT_LEAF;
@@ -860,9 +861,10 @@ static int rcu_panic(struct notifier_block *this, unsigned long ev, void *ptr)
860 */ 861 */
861void rcu_cpu_stall_reset(void) 862void rcu_cpu_stall_reset(void)
862{ 863{
863 rcu_sched_state.jiffies_stall = jiffies + ULONG_MAX / 2; 864 struct rcu_state *rsp;
864 rcu_bh_state.jiffies_stall = jiffies + ULONG_MAX / 2; 865
865 rcu_preempt_stall_reset(); 866 for_each_rcu_flavor(rsp)
867 rsp->jiffies_stall = jiffies + ULONG_MAX / 2;
866} 868}
867 869
868static struct notifier_block rcu_panic_block = { 870static struct notifier_block rcu_panic_block = {
@@ -1827,10 +1829,11 @@ __rcu_process_callbacks(struct rcu_state *rsp)
1827 */ 1829 */
1828static void rcu_process_callbacks(struct softirq_action *unused) 1830static void rcu_process_callbacks(struct softirq_action *unused)
1829{ 1831{
1832 struct rcu_state *rsp;
1833
1830 trace_rcu_utilization("Start RCU core"); 1834 trace_rcu_utilization("Start RCU core");
1831 __rcu_process_callbacks(&rcu_sched_state); 1835 for_each_rcu_flavor(rsp)
1832 __rcu_process_callbacks(&rcu_bh_state); 1836 __rcu_process_callbacks(rsp);
1833 rcu_preempt_process_callbacks();
1834 trace_rcu_utilization("End RCU core"); 1837 trace_rcu_utilization("End RCU core");
1835} 1838}
1836 1839
@@ -2241,9 +2244,12 @@ static int __rcu_pending(struct rcu_state *rsp, struct rcu_data *rdp)
2241 */ 2244 */
2242static int rcu_pending(int cpu) 2245static int rcu_pending(int cpu)
2243{ 2246{
2244 return __rcu_pending(&rcu_sched_state, &per_cpu(rcu_sched_data, cpu)) || 2247 struct rcu_state *rsp;
2245 __rcu_pending(&rcu_bh_state, &per_cpu(rcu_bh_data, cpu)) || 2248
2246 rcu_preempt_pending(cpu); 2249 for_each_rcu_flavor(rsp)
2250 if (__rcu_pending(rsp, per_cpu_ptr(rsp->rda, cpu)))
2251 return 1;
2252 return 0;
2247} 2253}
2248 2254
2249/* 2255/*
@@ -2253,10 +2259,13 @@ static int rcu_pending(int cpu)
2253 */ 2259 */
2254static int rcu_cpu_has_callbacks(int cpu) 2260static int rcu_cpu_has_callbacks(int cpu)
2255{ 2261{
2262 struct rcu_state *rsp;
2263
2256 /* RCU callbacks either ready or pending? */ 2264 /* RCU callbacks either ready or pending? */
2257 return per_cpu(rcu_sched_data, cpu).nxtlist || 2265 for_each_rcu_flavor(rsp)
2258 per_cpu(rcu_bh_data, cpu).nxtlist || 2266 if (per_cpu_ptr(rsp->rda, cpu)->nxtlist)
2259 rcu_preempt_cpu_has_callbacks(cpu); 2267 return 1;
2268 return 0;
2260} 2269}
2261 2270
2262/* 2271/*
@@ -2551,9 +2560,11 @@ rcu_init_percpu_data(int cpu, struct rcu_state *rsp, int preemptible)
2551 2560
2552static void __cpuinit rcu_prepare_cpu(int cpu) 2561static void __cpuinit rcu_prepare_cpu(int cpu)
2553{ 2562{
2554 rcu_init_percpu_data(cpu, &rcu_sched_state, 0); 2563 struct rcu_state *rsp;
2555 rcu_init_percpu_data(cpu, &rcu_bh_state, 0); 2564
2556 rcu_preempt_init_percpu_data(cpu); 2565 for_each_rcu_flavor(rsp)
2566 rcu_init_percpu_data(cpu, rsp,
2567 strcmp(rsp->name, "rcu_preempt") == 0);
2557} 2568}
2558 2569
2559/* 2570/*
@@ -2565,6 +2576,7 @@ static int __cpuinit rcu_cpu_notify(struct notifier_block *self,
2565 long cpu = (long)hcpu; 2576 long cpu = (long)hcpu;
2566 struct rcu_data *rdp = per_cpu_ptr(rcu_state->rda, cpu); 2577 struct rcu_data *rdp = per_cpu_ptr(rcu_state->rda, cpu);
2567 struct rcu_node *rnp = rdp->mynode; 2578 struct rcu_node *rnp = rdp->mynode;
2579 struct rcu_state *rsp;
2568 2580
2569 trace_rcu_utilization("Start CPU hotplug"); 2581 trace_rcu_utilization("Start CPU hotplug");
2570 switch (action) { 2582 switch (action) {
@@ -2589,18 +2601,16 @@ static int __cpuinit rcu_cpu_notify(struct notifier_block *self,
2589 * touch any data without introducing corruption. We send the 2601 * touch any data without introducing corruption. We send the
2590 * dying CPU's callbacks to an arbitrarily chosen online CPU. 2602 * dying CPU's callbacks to an arbitrarily chosen online CPU.
2591 */ 2603 */
2592 rcu_cleanup_dying_cpu(&rcu_bh_state); 2604 for_each_rcu_flavor(rsp)
2593 rcu_cleanup_dying_cpu(&rcu_sched_state); 2605 rcu_cleanup_dying_cpu(rsp);
2594 rcu_preempt_cleanup_dying_cpu();
2595 rcu_cleanup_after_idle(cpu); 2606 rcu_cleanup_after_idle(cpu);
2596 break; 2607 break;
2597 case CPU_DEAD: 2608 case CPU_DEAD:
2598 case CPU_DEAD_FROZEN: 2609 case CPU_DEAD_FROZEN:
2599 case CPU_UP_CANCELED: 2610 case CPU_UP_CANCELED:
2600 case CPU_UP_CANCELED_FROZEN: 2611 case CPU_UP_CANCELED_FROZEN:
2601 rcu_cleanup_dead_cpu(cpu, &rcu_bh_state); 2612 for_each_rcu_flavor(rsp)
2602 rcu_cleanup_dead_cpu(cpu, &rcu_sched_state); 2613 rcu_cleanup_dead_cpu(cpu, rsp);
2603 rcu_preempt_cleanup_dead_cpu(cpu);
2604 break; 2614 break;
2605 default: 2615 default:
2606 break; 2616 break;
@@ -2717,6 +2727,7 @@ static void __init rcu_init_one(struct rcu_state *rsp,
2717 per_cpu_ptr(rsp->rda, i)->mynode = rnp; 2727 per_cpu_ptr(rsp->rda, i)->mynode = rnp;
2718 rcu_boot_init_percpu_data(i, rsp); 2728 rcu_boot_init_percpu_data(i, rsp);
2719 } 2729 }
2730 list_add(&rsp->flavors, &rcu_struct_flavors);
2720} 2731}
2721 2732
2722/* 2733/*
diff --git a/kernel/rcutree.h b/kernel/rcutree.h
index be10286ad380..b92c4550a6e6 100644
--- a/kernel/rcutree.h
+++ b/kernel/rcutree.h
@@ -422,8 +422,13 @@ struct rcu_state {
422 unsigned long gp_max; /* Maximum GP duration in */ 422 unsigned long gp_max; /* Maximum GP duration in */
423 /* jiffies. */ 423 /* jiffies. */
424 char *name; /* Name of structure. */ 424 char *name; /* Name of structure. */
425 struct list_head flavors; /* List of RCU flavors. */
425}; 426};
426 427
428extern struct list_head rcu_struct_flavors;
429#define for_each_rcu_flavor(rsp) \
430 list_for_each_entry((rsp), &rcu_struct_flavors, flavors)
431
427/* Return values for rcu_preempt_offline_tasks(). */ 432/* Return values for rcu_preempt_offline_tasks(). */
428 433
429#define RCU_OFL_TASKS_NORM_GP 0x1 /* Tasks blocking normal */ 434#define RCU_OFL_TASKS_NORM_GP 0x1 /* Tasks blocking normal */
@@ -466,25 +471,18 @@ static void rcu_stop_cpu_kthread(int cpu);
466#endif /* #ifdef CONFIG_HOTPLUG_CPU */ 471#endif /* #ifdef CONFIG_HOTPLUG_CPU */
467static void rcu_print_detail_task_stall(struct rcu_state *rsp); 472static void rcu_print_detail_task_stall(struct rcu_state *rsp);
468static int rcu_print_task_stall(struct rcu_node *rnp); 473static int rcu_print_task_stall(struct rcu_node *rnp);
469static void rcu_preempt_stall_reset(void);
470static void rcu_preempt_check_blocked_tasks(struct rcu_node *rnp); 474static void rcu_preempt_check_blocked_tasks(struct rcu_node *rnp);
471#ifdef CONFIG_HOTPLUG_CPU 475#ifdef CONFIG_HOTPLUG_CPU
472static int rcu_preempt_offline_tasks(struct rcu_state *rsp, 476static int rcu_preempt_offline_tasks(struct rcu_state *rsp,
473 struct rcu_node *rnp, 477 struct rcu_node *rnp,
474 struct rcu_data *rdp); 478 struct rcu_data *rdp);
475#endif /* #ifdef CONFIG_HOTPLUG_CPU */ 479#endif /* #ifdef CONFIG_HOTPLUG_CPU */
476static void rcu_preempt_cleanup_dead_cpu(int cpu);
477static void rcu_preempt_check_callbacks(int cpu); 480static void rcu_preempt_check_callbacks(int cpu);
478static void rcu_preempt_process_callbacks(void);
479void call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *rcu)); 481void call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *rcu));
480#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_TREE_PREEMPT_RCU) 482#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_TREE_PREEMPT_RCU)
481static void rcu_report_exp_rnp(struct rcu_state *rsp, struct rcu_node *rnp, 483static void rcu_report_exp_rnp(struct rcu_state *rsp, struct rcu_node *rnp,
482 bool wake); 484 bool wake);
483#endif /* #if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_TREE_PREEMPT_RCU) */ 485#endif /* #if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_TREE_PREEMPT_RCU) */
484static int rcu_preempt_pending(int cpu);
485static int rcu_preempt_cpu_has_callbacks(int cpu);
486static void __cpuinit rcu_preempt_init_percpu_data(int cpu);
487static void rcu_preempt_cleanup_dying_cpu(void);
488static void __init __rcu_init_preempt(void); 486static void __init __rcu_init_preempt(void);
489static void rcu_initiate_boost(struct rcu_node *rnp, unsigned long flags); 487static void rcu_initiate_boost(struct rcu_node *rnp, unsigned long flags);
490static void rcu_preempt_boost_start_gp(struct rcu_node *rnp); 488static void rcu_preempt_boost_start_gp(struct rcu_node *rnp);
diff --git a/kernel/rcutree_plugin.h b/kernel/rcutree_plugin.h
index 5a80cdd9a0a3..d18b4d383afe 100644
--- a/kernel/rcutree_plugin.h
+++ b/kernel/rcutree_plugin.h
@@ -545,16 +545,6 @@ static int rcu_print_task_stall(struct rcu_node *rnp)
545} 545}
546 546
547/* 547/*
548 * Suppress preemptible RCU's CPU stall warnings by pushing the
549 * time of the next stall-warning message comfortably far into the
550 * future.
551 */
552static void rcu_preempt_stall_reset(void)
553{
554 rcu_preempt_state.jiffies_stall = jiffies + ULONG_MAX / 2;
555}
556
557/*
558 * Check that the list of blocked tasks for the newly completed grace 548 * Check that the list of blocked tasks for the newly completed grace
559 * period is in fact empty. It is a serious bug to complete a grace 549 * period is in fact empty. It is a serious bug to complete a grace
560 * period that still has RCU readers blocked! This function must be 550 * period that still has RCU readers blocked! This function must be
@@ -655,14 +645,6 @@ static int rcu_preempt_offline_tasks(struct rcu_state *rsp,
655#endif /* #ifdef CONFIG_HOTPLUG_CPU */ 645#endif /* #ifdef CONFIG_HOTPLUG_CPU */
656 646
657/* 647/*
658 * Do CPU-offline processing for preemptible RCU.
659 */
660static void rcu_preempt_cleanup_dead_cpu(int cpu)
661{
662 rcu_cleanup_dead_cpu(cpu, &rcu_preempt_state);
663}
664
665/*
666 * Check for a quiescent state from the current CPU. When a task blocks, 648 * Check for a quiescent state from the current CPU. When a task blocks,
667 * the task is recorded in the corresponding CPU's rcu_node structure, 649 * the task is recorded in the corresponding CPU's rcu_node structure,
668 * which is checked elsewhere. 650 * which is checked elsewhere.
@@ -682,14 +664,6 @@ static void rcu_preempt_check_callbacks(int cpu)
682 t->rcu_read_unlock_special |= RCU_READ_UNLOCK_NEED_QS; 664 t->rcu_read_unlock_special |= RCU_READ_UNLOCK_NEED_QS;
683} 665}
684 666
685/*
686 * Process callbacks for preemptible RCU.
687 */
688static void rcu_preempt_process_callbacks(void)
689{
690 __rcu_process_callbacks(&rcu_preempt_state);
691}
692
693#ifdef CONFIG_RCU_BOOST 667#ifdef CONFIG_RCU_BOOST
694 668
695static void rcu_preempt_do_callbacks(void) 669static void rcu_preempt_do_callbacks(void)
@@ -921,24 +895,6 @@ mb_ret:
921} 895}
922EXPORT_SYMBOL_GPL(synchronize_rcu_expedited); 896EXPORT_SYMBOL_GPL(synchronize_rcu_expedited);
923 897
924/*
925 * Check to see if there is any immediate preemptible-RCU-related work
926 * to be done.
927 */
928static int rcu_preempt_pending(int cpu)
929{
930 return __rcu_pending(&rcu_preempt_state,
931 &per_cpu(rcu_preempt_data, cpu));
932}
933
934/*
935 * Does preemptible RCU have callbacks on this CPU?
936 */
937static int rcu_preempt_cpu_has_callbacks(int cpu)
938{
939 return !!per_cpu(rcu_preempt_data, cpu).nxtlist;
940}
941
942/** 898/**
943 * rcu_barrier - Wait until all in-flight call_rcu() callbacks complete. 899 * rcu_barrier - Wait until all in-flight call_rcu() callbacks complete.
944 */ 900 */
@@ -949,23 +905,6 @@ void rcu_barrier(void)
949EXPORT_SYMBOL_GPL(rcu_barrier); 905EXPORT_SYMBOL_GPL(rcu_barrier);
950 906
951/* 907/*
952 * Initialize preemptible RCU's per-CPU data.
953 */
954static void __cpuinit rcu_preempt_init_percpu_data(int cpu)
955{
956 rcu_init_percpu_data(cpu, &rcu_preempt_state, 1);
957}
958
959/*
960 * Move preemptible RCU's callbacks from dying CPU to other online CPU
961 * and record a quiescent state.
962 */
963static void rcu_preempt_cleanup_dying_cpu(void)
964{
965 rcu_cleanup_dying_cpu(&rcu_preempt_state);
966}
967
968/*
969 * Initialize preemptible RCU's state structures. 908 * Initialize preemptible RCU's state structures.
970 */ 909 */
971static void __init __rcu_init_preempt(void) 910static void __init __rcu_init_preempt(void)
@@ -1050,14 +989,6 @@ static int rcu_print_task_stall(struct rcu_node *rnp)
1050} 989}
1051 990
1052/* 991/*
1053 * Because preemptible RCU does not exist, there is no need to suppress
1054 * its CPU stall warnings.
1055 */
1056static void rcu_preempt_stall_reset(void)
1057{
1058}
1059
1060/*
1061 * Because there is no preemptible RCU, there can be no readers blocked, 992 * Because there is no preemptible RCU, there can be no readers blocked,
1062 * so there is no need to check for blocked tasks. So check only for 993 * so there is no need to check for blocked tasks. So check only for
1063 * bogus qsmask values. 994 * bogus qsmask values.
@@ -1085,14 +1016,6 @@ static int rcu_preempt_offline_tasks(struct rcu_state *rsp,
1085#endif /* #ifdef CONFIG_HOTPLUG_CPU */ 1016#endif /* #ifdef CONFIG_HOTPLUG_CPU */
1086 1017
1087/* 1018/*
1088 * Because preemptible RCU does not exist, it never needs CPU-offline
1089 * processing.
1090 */
1091static void rcu_preempt_cleanup_dead_cpu(int cpu)
1092{
1093}
1094
1095/*
1096 * Because preemptible RCU does not exist, it never has any callbacks 1019 * Because preemptible RCU does not exist, it never has any callbacks
1097 * to check. 1020 * to check.
1098 */ 1021 */
@@ -1101,14 +1024,6 @@ static void rcu_preempt_check_callbacks(int cpu)
1101} 1024}
1102 1025
1103/* 1026/*
1104 * Because preemptible RCU does not exist, it never has any callbacks
1105 * to process.
1106 */
1107static void rcu_preempt_process_callbacks(void)
1108{
1109}
1110
1111/*
1112 * Queue an RCU callback for lazy invocation after a grace period. 1027 * Queue an RCU callback for lazy invocation after a grace period.
1113 * This will likely be later named something like "call_rcu_lazy()", 1028 * This will likely be later named something like "call_rcu_lazy()",
1114 * but this change will require some way of tagging the lazy RCU 1029 * but this change will require some way of tagging the lazy RCU
@@ -1149,22 +1064,6 @@ static void rcu_report_exp_rnp(struct rcu_state *rsp, struct rcu_node *rnp,
1149#endif /* #ifdef CONFIG_HOTPLUG_CPU */ 1064#endif /* #ifdef CONFIG_HOTPLUG_CPU */
1150 1065
1151/* 1066/*
1152 * Because preemptible RCU does not exist, it never has any work to do.
1153 */
1154static int rcu_preempt_pending(int cpu)
1155{
1156 return 0;
1157}
1158
1159/*
1160 * Because preemptible RCU does not exist, it never has callbacks
1161 */
1162static int rcu_preempt_cpu_has_callbacks(int cpu)
1163{
1164 return 0;
1165}
1166
1167/*
1168 * Because preemptible RCU does not exist, rcu_barrier() is just 1067 * Because preemptible RCU does not exist, rcu_barrier() is just
1169 * another name for rcu_barrier_sched(). 1068 * another name for rcu_barrier_sched().
1170 */ 1069 */
@@ -1175,21 +1074,6 @@ void rcu_barrier(void)
1175EXPORT_SYMBOL_GPL(rcu_barrier); 1074EXPORT_SYMBOL_GPL(rcu_barrier);
1176 1075
1177/* 1076/*
1178 * Because preemptible RCU does not exist, there is no per-CPU
1179 * data to initialize.
1180 */
1181static void __cpuinit rcu_preempt_init_percpu_data(int cpu)
1182{
1183}
1184
1185/*
1186 * Because there is no preemptible RCU, there is no cleanup to do.
1187 */
1188static void rcu_preempt_cleanup_dying_cpu(void)
1189{
1190}
1191
1192/*
1193 * Because preemptible RCU does not exist, it need not be initialized. 1077 * Because preemptible RCU does not exist, it need not be initialized.
1194 */ 1078 */
1195static void __init __rcu_init_preempt(void) 1079static void __init __rcu_init_preempt(void)