diff options
author | Paul E. McKenney <paul.mckenney@linaro.org> | 2011-04-14 15:13:53 -0400 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2011-05-06 02:16:55 -0400 |
commit | 0f962a5e7277c34987b77dc82fc9aefcedc95e27 (patch) | |
tree | b265d93dcc8f2669f8fb9b353344b9f6cc354728 /kernel/rcutree.c | |
parent | 27f4d28057adf98750cf863c40baefb12f5b6d21 (diff) |
rcu: Force per-rcu_node kthreads off of the outgoing CPU
The scheduler has had some heartburn in the past when too many real-time
kthreads were affinitied to the outgoing CPU. So, this commit lightens
the load by forcing the per-rcu_node and the boost kthreads off of the
outgoing CPU. Note that RCU's per-CPU kthread remains on the outgoing
CPU until the bitter end, as it must in order to preserve correctness.
Also avoid disabling hardirqs across calls to set_cpus_allowed_ptr(),
given that this function can block.
Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'kernel/rcutree.c')
-rw-r--r-- | kernel/rcutree.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/kernel/rcutree.c b/kernel/rcutree.c index 28fd92a9e0d0..51eef4193e7c 100644 --- a/kernel/rcutree.c +++ b/kernel/rcutree.c | |||
@@ -95,7 +95,7 @@ static DEFINE_PER_CPU(wait_queue_head_t, rcu_cpu_wq); | |||
95 | static DEFINE_PER_CPU(char, rcu_cpu_has_work); | 95 | static DEFINE_PER_CPU(char, rcu_cpu_has_work); |
96 | static char rcu_kthreads_spawnable; | 96 | static char rcu_kthreads_spawnable; |
97 | 97 | ||
98 | static void rcu_node_kthread_setaffinity(struct rcu_node *rnp); | 98 | static void rcu_node_kthread_setaffinity(struct rcu_node *rnp, int outgoingcpu); |
99 | static void invoke_rcu_cpu_kthread(void); | 99 | static void invoke_rcu_cpu_kthread(void); |
100 | 100 | ||
101 | #define RCU_KTHREAD_PRIO 1 /* RT priority for per-CPU kthreads. */ | 101 | #define RCU_KTHREAD_PRIO 1 /* RT priority for per-CPU kthreads. */ |
@@ -1099,7 +1099,7 @@ static void __rcu_offline_cpu(int cpu, struct rcu_state *rsp) | |||
1099 | kthread_stop(t); | 1099 | kthread_stop(t); |
1100 | rcu_stop_boost_kthread(rnp); | 1100 | rcu_stop_boost_kthread(rnp); |
1101 | } else | 1101 | } else |
1102 | rcu_node_kthread_setaffinity(rnp); | 1102 | rcu_node_kthread_setaffinity(rnp, -1); |
1103 | } | 1103 | } |
1104 | 1104 | ||
1105 | /* | 1105 | /* |
@@ -1644,8 +1644,12 @@ static int rcu_node_kthread(void *arg) | |||
1644 | * Set the per-rcu_node kthread's affinity to cover all CPUs that are | 1644 | * Set the per-rcu_node kthread's affinity to cover all CPUs that are |
1645 | * served by the rcu_node in question. The CPU hotplug lock is still | 1645 | * served by the rcu_node in question. The CPU hotplug lock is still |
1646 | * held, so the value of rnp->qsmaskinit will be stable. | 1646 | * held, so the value of rnp->qsmaskinit will be stable. |
1647 | * | ||
1648 | * We don't include outgoingcpu in the affinity set, use -1 if there is | ||
1649 | * no outgoing CPU. If there are no CPUs left in the affinity set, | ||
1650 | * this function allows the kthread to execute on any CPU. | ||
1647 | */ | 1651 | */ |
1648 | static void rcu_node_kthread_setaffinity(struct rcu_node *rnp) | 1652 | static void rcu_node_kthread_setaffinity(struct rcu_node *rnp, int outgoingcpu) |
1649 | { | 1653 | { |
1650 | cpumask_var_t cm; | 1654 | cpumask_var_t cm; |
1651 | int cpu; | 1655 | int cpu; |
@@ -1657,8 +1661,14 @@ static void rcu_node_kthread_setaffinity(struct rcu_node *rnp) | |||
1657 | return; | 1661 | return; |
1658 | cpumask_clear(cm); | 1662 | cpumask_clear(cm); |
1659 | for (cpu = rnp->grplo; cpu <= rnp->grphi; cpu++, mask >>= 1) | 1663 | for (cpu = rnp->grplo; cpu <= rnp->grphi; cpu++, mask >>= 1) |
1660 | if (mask & 0x1) | 1664 | if ((mask & 0x1) && cpu != outgoingcpu) |
1661 | cpumask_set_cpu(cpu, cm); | 1665 | cpumask_set_cpu(cpu, cm); |
1666 | if (cpumask_weight(cm) == 0) { | ||
1667 | cpumask_setall(cm); | ||
1668 | for (cpu = rnp->grplo; cpu <= rnp->grphi; cpu++) | ||
1669 | cpumask_clear_cpu(cpu, cm); | ||
1670 | WARN_ON_ONCE(cpumask_weight(cm) == 0); | ||
1671 | } | ||
1662 | set_cpus_allowed_ptr(rnp->node_kthread_task, cm); | 1672 | set_cpus_allowed_ptr(rnp->node_kthread_task, cm); |
1663 | rcu_boost_kthread_setaffinity(rnp, cm); | 1673 | rcu_boost_kthread_setaffinity(rnp, cm); |
1664 | free_cpumask_var(cm); | 1674 | free_cpumask_var(cm); |
@@ -2154,7 +2164,11 @@ static int __cpuinit rcu_cpu_notify(struct notifier_block *self, | |||
2154 | rcu_online_kthreads(cpu); | 2164 | rcu_online_kthreads(cpu); |
2155 | break; | 2165 | break; |
2156 | case CPU_ONLINE: | 2166 | case CPU_ONLINE: |
2157 | rcu_node_kthread_setaffinity(rnp); | 2167 | case CPU_DOWN_FAILED: |
2168 | rcu_node_kthread_setaffinity(rnp, -1); | ||
2169 | break; | ||
2170 | case CPU_DOWN_PREPARE: | ||
2171 | rcu_node_kthread_setaffinity(rnp, cpu); | ||
2158 | break; | 2172 | break; |
2159 | case CPU_DYING: | 2173 | case CPU_DYING: |
2160 | case CPU_DYING_FROZEN: | 2174 | case CPU_DYING_FROZEN: |