提交 9386c0b7 编写于 作者: P Paul E. McKenney

rcu: Rationalize kthread spawning

Currently, RCU spawns kthreads from several different early_initcall()
functions.  Although this has served RCU well for quite some time,
as more kthreads are added a more deterministic approach is required.
This commit therefore causes all of RCU's early-boot kthreads to be
spawned from a single early_initcall() function.
Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: NJosh Triplett <josh@joshtriplett.org>
Tested-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
上级 f4aa84ba
...@@ -3489,7 +3489,7 @@ static int rcu_pm_notify(struct notifier_block *self, ...@@ -3489,7 +3489,7 @@ static int rcu_pm_notify(struct notifier_block *self,
} }
/* /*
* Spawn the kthread that handles this RCU flavor's grace periods. * Spawn the kthreads that handle each RCU flavor's grace periods.
*/ */
static int __init rcu_spawn_gp_kthread(void) static int __init rcu_spawn_gp_kthread(void)
{ {
...@@ -3498,6 +3498,7 @@ static int __init rcu_spawn_gp_kthread(void) ...@@ -3498,6 +3498,7 @@ static int __init rcu_spawn_gp_kthread(void)
struct rcu_state *rsp; struct rcu_state *rsp;
struct task_struct *t; struct task_struct *t;
rcu_scheduler_fully_active = 1;
for_each_rcu_flavor(rsp) { for_each_rcu_flavor(rsp) {
t = kthread_run(rcu_gp_kthread, rsp, "%s", rsp->name); t = kthread_run(rcu_gp_kthread, rsp, "%s", rsp->name);
BUG_ON(IS_ERR(t)); BUG_ON(IS_ERR(t));
...@@ -3507,6 +3508,7 @@ static int __init rcu_spawn_gp_kthread(void) ...@@ -3507,6 +3508,7 @@ static int __init rcu_spawn_gp_kthread(void)
raw_spin_unlock_irqrestore(&rnp->lock, flags); raw_spin_unlock_irqrestore(&rnp->lock, flags);
rcu_spawn_nocb_kthreads(rsp); rcu_spawn_nocb_kthreads(rsp);
} }
rcu_spawn_boost_kthreads();
return 0; return 0;
} }
early_initcall(rcu_spawn_gp_kthread); early_initcall(rcu_spawn_gp_kthread);
......
...@@ -572,6 +572,7 @@ static void rcu_preempt_do_callbacks(void); ...@@ -572,6 +572,7 @@ static void rcu_preempt_do_callbacks(void);
static int rcu_spawn_one_boost_kthread(struct rcu_state *rsp, static int rcu_spawn_one_boost_kthread(struct rcu_state *rsp,
struct rcu_node *rnp); struct rcu_node *rnp);
#endif /* #ifdef CONFIG_RCU_BOOST */ #endif /* #ifdef CONFIG_RCU_BOOST */
static void __init rcu_spawn_boost_kthreads(void);
static void rcu_prepare_kthreads(int cpu); static void rcu_prepare_kthreads(int cpu);
static void rcu_cleanup_after_idle(int cpu); static void rcu_cleanup_after_idle(int cpu);
static void rcu_prepare_for_idle(int cpu); static void rcu_prepare_for_idle(int cpu);
......
...@@ -1435,14 +1435,13 @@ static struct smp_hotplug_thread rcu_cpu_thread_spec = { ...@@ -1435,14 +1435,13 @@ static struct smp_hotplug_thread rcu_cpu_thread_spec = {
}; };
/* /*
* Spawn all kthreads -- called as soon as the scheduler is running. * Spawn boost kthreads -- called as soon as the scheduler is running.
*/ */
static int __init rcu_spawn_kthreads(void) static void __init rcu_spawn_boost_kthreads(void)
{ {
struct rcu_node *rnp; struct rcu_node *rnp;
int cpu; int cpu;
rcu_scheduler_fully_active = 1;
for_each_possible_cpu(cpu) for_each_possible_cpu(cpu)
per_cpu(rcu_cpu_has_work, cpu) = 0; per_cpu(rcu_cpu_has_work, cpu) = 0;
BUG_ON(smpboot_register_percpu_thread(&rcu_cpu_thread_spec)); BUG_ON(smpboot_register_percpu_thread(&rcu_cpu_thread_spec));
...@@ -1452,9 +1451,7 @@ static int __init rcu_spawn_kthreads(void) ...@@ -1452,9 +1451,7 @@ static int __init rcu_spawn_kthreads(void)
rcu_for_each_leaf_node(rcu_state_p, rnp) rcu_for_each_leaf_node(rcu_state_p, rnp)
(void)rcu_spawn_one_boost_kthread(rcu_state_p, rnp); (void)rcu_spawn_one_boost_kthread(rcu_state_p, rnp);
} }
return 0;
} }
early_initcall(rcu_spawn_kthreads);
static void rcu_prepare_kthreads(int cpu) static void rcu_prepare_kthreads(int cpu)
{ {
...@@ -1492,12 +1489,9 @@ static void rcu_boost_kthread_setaffinity(struct rcu_node *rnp, int outgoingcpu) ...@@ -1492,12 +1489,9 @@ static void rcu_boost_kthread_setaffinity(struct rcu_node *rnp, int outgoingcpu)
{ {
} }
static int __init rcu_scheduler_really_started(void) static void __init rcu_spawn_boost_kthreads(void)
{ {
rcu_scheduler_fully_active = 1;
return 0;
} }
early_initcall(rcu_scheduler_really_started);
static void rcu_prepare_kthreads(int cpu) static void rcu_prepare_kthreads(int cpu)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册