aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/workqueue.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2017-11-13 10:36:33 -0500
committerDavid Howells <dhowells@redhat.com>2017-11-13 10:36:33 -0500
commit81445e63e67a1e98b1c2575fa2b406d4289d2754 (patch)
tree2d121d1873b3e8ec7b71086c4db2f5cb207a46ec /kernel/workqueue.c
parentede372dcae15d3ba1d3d52ac45be7a27ce31be28 (diff)
parentb24591e2fcf852ad7ad2ccf745c8220bf378d312 (diff)
Merge remote-tracking branch 'tip/timers/core' into afs-next
These AFS patches need the timer_reduce() patch from timers/core. Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r--kernel/workqueue.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index a2dccfe1acec..3b67c0a0df16 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -1493,9 +1493,9 @@ bool queue_work_on(int cpu, struct workqueue_struct *wq,
1493} 1493}
1494EXPORT_SYMBOL(queue_work_on); 1494EXPORT_SYMBOL(queue_work_on);
1495 1495
1496void delayed_work_timer_fn(unsigned long __data) 1496void delayed_work_timer_fn(struct timer_list *t)
1497{ 1497{
1498 struct delayed_work *dwork = (struct delayed_work *)__data; 1498 struct delayed_work *dwork = from_timer(dwork, t, timer);
1499 1499
1500 /* should have been called from irqsafe timer with irq already off */ 1500 /* should have been called from irqsafe timer with irq already off */
1501 __queue_work(dwork->cpu, dwork->wq, &dwork->work); 1501 __queue_work(dwork->cpu, dwork->wq, &dwork->work);
@@ -1509,8 +1509,7 @@ static void __queue_delayed_work(int cpu, struct workqueue_struct *wq,
1509 struct work_struct *work = &dwork->work; 1509 struct work_struct *work = &dwork->work;
1510 1510
1511 WARN_ON_ONCE(!wq); 1511 WARN_ON_ONCE(!wq);
1512 WARN_ON_ONCE(timer->function != delayed_work_timer_fn || 1512 WARN_ON_ONCE(timer->function != (TIMER_FUNC_TYPE)delayed_work_timer_fn);
1513 timer->data != (unsigned long)dwork);
1514 WARN_ON_ONCE(timer_pending(timer)); 1513 WARN_ON_ONCE(timer_pending(timer));
1515 WARN_ON_ONCE(!list_empty(&work->entry)); 1514 WARN_ON_ONCE(!list_empty(&work->entry));
1516 1515
@@ -1833,9 +1832,9 @@ static void destroy_worker(struct worker *worker)
1833 wake_up_process(worker->task); 1832 wake_up_process(worker->task);
1834} 1833}
1835 1834
1836static void idle_worker_timeout(unsigned long __pool) 1835static void idle_worker_timeout(struct timer_list *t)
1837{ 1836{
1838 struct worker_pool *pool = (void *)__pool; 1837 struct worker_pool *pool = from_timer(pool, t, idle_timer);
1839 1838
1840 spin_lock_irq(&pool->lock); 1839 spin_lock_irq(&pool->lock);
1841 1840
@@ -1881,9 +1880,9 @@ static void send_mayday(struct work_struct *work)
1881 } 1880 }
1882} 1881}
1883 1882
1884static void pool_mayday_timeout(unsigned long __pool) 1883static void pool_mayday_timeout(struct timer_list *t)
1885{ 1884{
1886 struct worker_pool *pool = (void *)__pool; 1885 struct worker_pool *pool = from_timer(pool, t, mayday_timer);
1887 struct work_struct *work; 1886 struct work_struct *work;
1888 1887
1889 spin_lock_irq(&pool->lock); 1888 spin_lock_irq(&pool->lock);
@@ -3236,11 +3235,9 @@ static int init_worker_pool(struct worker_pool *pool)
3236 INIT_LIST_HEAD(&pool->idle_list); 3235 INIT_LIST_HEAD(&pool->idle_list);
3237 hash_init(pool->busy_hash); 3236 hash_init(pool->busy_hash);
3238 3237
3239 setup_deferrable_timer(&pool->idle_timer, idle_worker_timeout, 3238 timer_setup(&pool->idle_timer, idle_worker_timeout, TIMER_DEFERRABLE);
3240 (unsigned long)pool);
3241 3239
3242 setup_timer(&pool->mayday_timer, pool_mayday_timeout, 3240 timer_setup(&pool->mayday_timer, pool_mayday_timeout, 0);
3243 (unsigned long)pool);
3244 3241
3245 mutex_init(&pool->attach_mutex); 3242 mutex_init(&pool->attach_mutex);
3246 INIT_LIST_HEAD(&pool->workers); 3243 INIT_LIST_HEAD(&pool->workers);
@@ -5383,11 +5380,8 @@ static void workqueue_sysfs_unregister(struct workqueue_struct *wq) { }
5383 */ 5380 */
5384#ifdef CONFIG_WQ_WATCHDOG 5381#ifdef CONFIG_WQ_WATCHDOG
5385 5382
5386static void wq_watchdog_timer_fn(unsigned long data);
5387
5388static unsigned long wq_watchdog_thresh = 30; 5383static unsigned long wq_watchdog_thresh = 30;
5389static struct timer_list wq_watchdog_timer = 5384static struct timer_list wq_watchdog_timer;
5390 TIMER_DEFERRED_INITIALIZER(wq_watchdog_timer_fn, 0, 0);
5391 5385
5392static unsigned long wq_watchdog_touched = INITIAL_JIFFIES; 5386static unsigned long wq_watchdog_touched = INITIAL_JIFFIES;
5393static DEFINE_PER_CPU(unsigned long, wq_watchdog_touched_cpu) = INITIAL_JIFFIES; 5387static DEFINE_PER_CPU(unsigned long, wq_watchdog_touched_cpu) = INITIAL_JIFFIES;
@@ -5401,7 +5395,7 @@ static void wq_watchdog_reset_touched(void)
5401 per_cpu(wq_watchdog_touched_cpu, cpu) = jiffies; 5395 per_cpu(wq_watchdog_touched_cpu, cpu) = jiffies;
5402} 5396}
5403 5397
5404static void wq_watchdog_timer_fn(unsigned long data) 5398static void wq_watchdog_timer_fn(struct timer_list *unused)
5405{ 5399{
5406 unsigned long thresh = READ_ONCE(wq_watchdog_thresh) * HZ; 5400 unsigned long thresh = READ_ONCE(wq_watchdog_thresh) * HZ;
5407 bool lockup_detected = false; 5401 bool lockup_detected = false;
@@ -5503,6 +5497,7 @@ module_param_cb(watchdog_thresh, &wq_watchdog_thresh_ops, &wq_watchdog_thresh,
5503 5497
5504static void wq_watchdog_init(void) 5498static void wq_watchdog_init(void)
5505{ 5499{
5500 timer_setup(&wq_watchdog_timer, wq_watchdog_timer_fn, TIMER_DEFERRABLE);
5506 wq_watchdog_set_thresh(wq_watchdog_thresh); 5501 wq_watchdog_set_thresh(wq_watchdog_thresh);
5507} 5502}
5508 5503