aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2012-07-17 12:39:26 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-08-09 08:27:36 -0700
commitb1c7ba1bab7363fee6dc5d4ee5be4e916adcf691 (patch)
treeeaf3430b4b7aa826737e22088958ba0f460d3380 /include
parent8d50f086b22f886265031643748e4089257c768b (diff)
downloadkernel_samsung_smdk4412-b1c7ba1bab7363fee6dc5d4ee5be4e916adcf691.zip
kernel_samsung_smdk4412-b1c7ba1bab7363fee6dc5d4ee5be4e916adcf691.tar.gz
kernel_samsung_smdk4412-b1c7ba1bab7363fee6dc5d4ee5be4e916adcf691.tar.bz2
workqueue: perform cpu down operations from low priority cpu_notifier()
commit 6575820221f7a4dd6eadecf7bf83cdd154335eda upstream. Currently, all workqueue cpu hotplug operations run off CPU_PRI_WORKQUEUE which is higher than normal notifiers. This is to ensure that workqueue is up and running while bringing up a CPU before other notifiers try to use workqueue on the CPU. Per-cpu workqueues are supposed to remain working and bound to the CPU for normal CPU_DOWN_PREPARE notifiers. This holds mostly true even with workqueue offlining running with higher priority because workqueue CPU_DOWN_PREPARE only creates a bound trustee thread which runs the per-cpu workqueue without concurrency management without explicitly detaching the existing workers. However, if the trustee needs to create new workers, it creates unbound workers which may wander off to other CPUs while CPU_DOWN_PREPARE notifiers are in progress. Furthermore, if the CPU down is cancelled, the per-CPU workqueue may end up with workers which aren't bound to the CPU. While reliably reproducible with a convoluted artificial test-case involving scheduling and flushing CPU burning work items from CPU down notifiers, this isn't very likely to happen in the wild, and, even when it happens, the effects are likely to be hidden by the following successful CPU down. Fix it by using different priorities for up and down notifiers - high priority for up operations and low priority for down operations. Workqueue cpu hotplug operations will soon go through further cleanup. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: "Rafael J. Wysocki" <rjw@sisk.pl> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/cpu.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 5f09323..42af2ea 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -66,8 +66,9 @@ enum {
/* migration should happen before other stuff but after perf */
CPU_PRI_PERF = 20,
CPU_PRI_MIGRATION = 10,
- /* prepare workqueues for other notifiers */
- CPU_PRI_WORKQUEUE = 5,
+ /* bring up workqueues before normal notifiers and down after */
+ CPU_PRI_WORKQUEUE_UP = 5,
+ CPU_PRI_WORKQUEUE_DOWN = -5,
};
#ifdef CONFIG_SMP