diff options
| author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2017-06-02 17:49:10 -0700 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2017-06-02 17:49:10 -0700 |
| commit | eadcbfa58ae8693f0d6a0f591d8f51d55cf068e1 (patch) | |
| tree | cff3f1c56a8bf15138b652ee9dab50dddd6edee5 /kernel/workqueue.c | |
| parent | c4beedb8a914af9c8c1b6e67c753adf411e05160 (diff) | |
| parent | 5ed02dbb497422bf225783f46e6eadd237d23d6b (diff) | |
| download | cachepc-linux-eadcbfa58ae8693f0d6a0f591d8f51d55cf068e1.tar.gz cachepc-linux-eadcbfa58ae8693f0d6a0f591d8f51d55cf068e1.zip | |
Merge tag 'v4.12-rc3' into for-linus
Merge with mainline to get acpi_dev_present() needed by patches to
axp20x-pek driver.
Diffstat (limited to 'kernel/workqueue.c')
| -rw-r--r-- | kernel/workqueue.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index c0168b7da1ea..c74bf39ef764 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -3209,9 +3209,8 @@ static int init_worker_pool(struct worker_pool *pool) INIT_LIST_HEAD(&pool->idle_list); hash_init(pool->busy_hash); - init_timer_deferrable(&pool->idle_timer); - pool->idle_timer.function = idle_worker_timeout; - pool->idle_timer.data = (unsigned long)pool; + setup_deferrable_timer(&pool->idle_timer, idle_worker_timeout, + (unsigned long)pool); setup_timer(&pool->mayday_timer, pool_mayday_timeout, (unsigned long)pool); @@ -4735,6 +4734,29 @@ long work_on_cpu(int cpu, long (*fn)(void *), void *arg) return wfc.ret; } EXPORT_SYMBOL_GPL(work_on_cpu); + +/** + * work_on_cpu_safe - run a function in thread context on a particular cpu + * @cpu: the cpu to run on + * @fn: the function to run + * @arg: the function argument + * + * Disables CPU hotplug and calls work_on_cpu(). The caller must not hold + * any locks which would prevent @fn from completing. + * + * Return: The value @fn returns. + */ +long work_on_cpu_safe(int cpu, long (*fn)(void *), void *arg) +{ + long ret = -ENODEV; + + get_online_cpus(); + if (cpu_online(cpu)) + ret = work_on_cpu(cpu, fn, arg); + put_online_cpus(); + return ret; +} +EXPORT_SYMBOL_GPL(work_on_cpu_safe); #endif /* CONFIG_SMP */ #ifdef CONFIG_FREEZER |
