Skip to content

Commit 033d995

Browse files
committed
Merge branch 'for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq
Pull workqueue changes from Tejun Heo: "This is workqueue updates for v3.7-rc1. A lot of activities this round including considerable API and behavior cleanups. * delayed_work combines a timer and a work item. The handling of the timer part has always been a bit clunky leading to confusing cancelation API with weird corner-case behaviors. delayed_work is updated to use new IRQ safe timer and cancelation now works as expected. * Another deficiency of delayed_work was lack of the counterpart of mod_timer() which led to cancel+queue combinations or open-coded timer+work usages. mod_delayed_work[_on]() are added. These two delayed_work changes make delayed_work provide interface and behave like timer which is executed with process context. * A work item could be executed concurrently on multiple CPUs, which is rather unintuitive and made flush_work() behavior confusing and half-broken under certain circumstances. This problem doesn't exist for non-reentrant workqueues. While non-reentrancy check isn't free, the overhead is incurred only when a work item bounces across different CPUs and even in simulated pathological scenario the overhead isn't too high. All workqueues are made non-reentrant. This removes the distinction between flush_[delayed_]work() and flush_[delayed_]_work_sync(). The former is now as strong as the latter and the specified work item is guaranteed to have finished execution of any previous queueing on return. * In addition to the various bug fixes, Lai redid and simplified CPU hotplug handling significantly. * Joonsoo introduced system_highpri_wq and used it during CPU hotplug. There are two merge commits - one to pull in IRQ safe timer from tip/timers/core and the other to pull in CPU hotplug fixes from wq/for-3.6-fixes as Lai's hotplug restructuring depended on them." Fixed a number of trivial conflicts, but the more interesting conflicts were silent ones where the deprecated interfaces had been used by new code in the merge window, and thus didn't cause any real data conflicts. Tejun pointed out a few of them, I fixed a couple more. * 'for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq: (46 commits) workqueue: remove spurious WARN_ON_ONCE(in_irq()) from try_to_grab_pending() workqueue: use cwq_set_max_active() helper for workqueue_set_max_active() workqueue: introduce cwq_set_max_active() helper for thaw_workqueues() workqueue: remove @delayed from cwq_dec_nr_in_flight() workqueue: fix possible stall on try_to_grab_pending() of a delayed work item workqueue: use hotcpu_notifier() for workqueue_cpu_down_callback() workqueue: use __cpuinit instead of __devinit for cpu callbacks workqueue: rename manager_mutex to assoc_mutex workqueue: WORKER_REBIND is no longer necessary for idle rebinding workqueue: WORKER_REBIND is no longer necessary for busy rebinding workqueue: reimplement idle worker rebinding workqueue: deprecate __cancel_delayed_work() workqueue: reimplement cancel_delayed_work() using try_to_grab_pending() workqueue: use mod_delayed_work() instead of __cancel + queue workqueue: use irqsafe timer for delayed_work workqueue: clean up delayed_work initializers and add missing one workqueue: make deferrable delayed_work initializer names consistent workqueue: cosmetic whitespace updates for macro definitions workqueue: deprecate system_nrt[_freezable]_wq workqueue: deprecate flush[_delayed]_work_sync() ...
2 parents 974a847 + 7c6e72e commit 033d995

134 files changed

Lines changed: 1047 additions & 1054 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎arch/arm/mach-pxa/sharpsl_pm.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -579,8 +579,8 @@ static int sharpsl_ac_check(void)
579579
static int sharpsl_pm_suspend(struct platform_device *pdev, pm_message_t state)
580580
{
581581
sharpsl_pm.flags |= SHARPSL_SUSPENDED;
582-
flush_delayed_work_sync(&toggle_charger);
583-
flush_delayed_work_sync(&sharpsl_bat);
582+
flush_delayed_work(&toggle_charger);
583+
flush_delayed_work(&sharpsl_bat);
584584

585585
if (sharpsl_pm.charge_mode == CHRG_ON)
586586
sharpsl_pm.flags |= SHARPSL_DO_OFFLINE_CHRG;

‎arch/arm/plat-omap/mailbox.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ static void omap_mbox_fini(struct omap_mbox *mbox)
310310
omap_mbox_disable_irq(mbox, IRQ_RX);
311311
free_irq(mbox->irq, mbox);
312312
tasklet_kill(&mbox->txq->tasklet);
313-
flush_work_sync(&mbox->rxq->work);
313+
flush_work(&mbox->rxq->work);
314314
mbox_queue_free(mbox->txq);
315315
mbox_queue_free(mbox->rxq);
316316
}

‎arch/powerpc/platforms/cell/cpufreq_spudemand.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ static void spu_gov_work(struct work_struct *work)
7676
static void spu_gov_init_work(struct spu_gov_info_struct *info)
7777
{
7878
int delay = usecs_to_jiffies(info->poll_int);
79-
INIT_DELAYED_WORK_DEFERRABLE(&info->work, spu_gov_work);
79+
INIT_DEFERRABLE_WORK(&info->work, spu_gov_work);
8080
schedule_delayed_work_on(info->policy->cpu, &info->work, delay);
8181
}
8282

‎arch/sh/drivers/push-switch.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ static int switch_drv_remove(struct platform_device *pdev)
107107
device_remove_file(&pdev->dev, &dev_attr_switch);
108108

109109
platform_set_drvdata(pdev, NULL);
110-
flush_work_sync(&psw->work);
110+
flush_work(&psw->work);
111111
del_timer_sync(&psw->debounce);
112112
free_irq(irq, pdev);
113113

‎block/blk-core.c‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ EXPORT_SYMBOL(blk_start_queue);
262262
**/
263263
void blk_stop_queue(struct request_queue *q)
264264
{
265-
__cancel_delayed_work(&q->delay_work);
265+
cancel_delayed_work(&q->delay_work);
266266
queue_flag_set(QUEUE_FLAG_STOPPED, q);
267267
}
268268
EXPORT_SYMBOL(blk_stop_queue);
@@ -319,10 +319,8 @@ EXPORT_SYMBOL(__blk_run_queue);
319319
*/
320320
void blk_run_queue_async(struct request_queue *q)
321321
{
322-
if (likely(!blk_queue_stopped(q))) {
323-
__cancel_delayed_work(&q->delay_work);
324-
queue_delayed_work(kblockd_workqueue, &q->delay_work, 0);
325-
}
322+
if (likely(!blk_queue_stopped(q)))
323+
mod_delayed_work(kblockd_workqueue, &q->delay_work, 0);
326324
}
327325
EXPORT_SYMBOL(blk_run_queue_async);
328326

‎block/blk-throttle.c‎

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ static inline unsigned int total_nr_queued(struct throtl_data *td)
180180

181181
/*
182182
* Worker for allocating per cpu stat for tgs. This is scheduled on the
183-
* system_nrt_wq once there are some groups on the alloc_list waiting for
183+
* system_wq once there are some groups on the alloc_list waiting for
184184
* allocation.
185185
*/
186186
static void tg_stats_alloc_fn(struct work_struct *work)
@@ -194,8 +194,7 @@ static void tg_stats_alloc_fn(struct work_struct *work)
194194
stats_cpu = alloc_percpu(struct tg_stats_cpu);
195195
if (!stats_cpu) {
196196
/* allocation failed, try again after some time */
197-
queue_delayed_work(system_nrt_wq, dwork,
198-
msecs_to_jiffies(10));
197+
schedule_delayed_work(dwork, msecs_to_jiffies(10));
199198
return;
200199
}
201200
}
@@ -238,7 +237,7 @@ static void throtl_pd_init(struct blkcg_gq *blkg)
238237
*/
239238
spin_lock_irqsave(&tg_stats_alloc_lock, flags);
240239
list_add(&tg->stats_alloc_node, &tg_stats_alloc_list);
241-
queue_delayed_work(system_nrt_wq, &tg_stats_alloc_work, 0);
240+
schedule_delayed_work(&tg_stats_alloc_work, 0);
242241
spin_unlock_irqrestore(&tg_stats_alloc_lock, flags);
243242
}
244243

@@ -930,12 +929,7 @@ throtl_schedule_delayed_work(struct throtl_data *td, unsigned long delay)
930929

931930
/* schedule work if limits changed even if no bio is queued */
932931
if (total_nr_queued(td) || td->limits_changed) {
933-
/*
934-
* We might have a work scheduled to be executed in future.
935-
* Cancel that and schedule a new one.
936-
*/
937-
__cancel_delayed_work(dwork);
938-
queue_delayed_work(kthrotld_workqueue, dwork, delay);
932+
mod_delayed_work(kthrotld_workqueue, dwork, delay);
939933
throtl_log(td, "schedule work. delay=%lu jiffies=%lu",
940934
delay, jiffies);
941935
}

‎block/genhd.c‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1490,9 +1490,9 @@ static void __disk_unblock_events(struct gendisk *disk, bool check_now)
14901490
intv = disk_events_poll_jiffies(disk);
14911491
set_timer_slack(&ev->dwork.timer, intv / 4);
14921492
if (check_now)
1493-
queue_delayed_work(system_nrt_freezable_wq, &ev->dwork, 0);
1493+
queue_delayed_work(system_freezable_wq, &ev->dwork, 0);
14941494
else if (intv)
1495-
queue_delayed_work(system_nrt_freezable_wq, &ev->dwork, intv);
1495+
queue_delayed_work(system_freezable_wq, &ev->dwork, intv);
14961496
out_unlock:
14971497
spin_unlock_irqrestore(&ev->lock, flags);
14981498
}
@@ -1534,10 +1534,8 @@ void disk_flush_events(struct gendisk *disk, unsigned int mask)
15341534

15351535
spin_lock_irq(&ev->lock);
15361536
ev->clearing |= mask;
1537-
if (!ev->block) {
1538-
cancel_delayed_work(&ev->dwork);
1539-
queue_delayed_work(system_nrt_freezable_wq, &ev->dwork, 0);
1540-
}
1537+
if (!ev->block)
1538+
mod_delayed_work(system_freezable_wq, &ev->dwork, 0);
15411539
spin_unlock_irq(&ev->lock);
15421540
}
15431541

@@ -1573,7 +1571,7 @@ unsigned int disk_clear_events(struct gendisk *disk, unsigned int mask)
15731571

15741572
/* uncondtionally schedule event check and wait for it to finish */
15751573
disk_block_events(disk);
1576-
queue_delayed_work(system_nrt_freezable_wq, &ev->dwork, 0);
1574+
queue_delayed_work(system_freezable_wq, &ev->dwork, 0);
15771575
flush_delayed_work(&ev->dwork);
15781576
__disk_unblock_events(disk, false);
15791577

@@ -1610,7 +1608,7 @@ static void disk_events_workfn(struct work_struct *work)
16101608

16111609
intv = disk_events_poll_jiffies(disk);
16121610
if (!ev->block && intv)
1613-
queue_delayed_work(system_nrt_freezable_wq, &ev->dwork, intv);
1611+
queue_delayed_work(system_freezable_wq, &ev->dwork, intv);
16141612

16151613
spin_unlock_irq(&ev->lock);
16161614

‎drivers/block/floppy.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -672,15 +672,14 @@ static void __reschedule_timeout(int drive, const char *message)
672672

673673
if (drive == current_reqD)
674674
drive = current_drive;
675-
__cancel_delayed_work(&fd_timeout);
676675

677676
if (drive < 0 || drive >= N_DRIVE) {
678677
delay = 20UL * HZ;
679678
drive = 0;
680679
} else
681680
delay = UDP->timeout;
682681

683-
queue_delayed_work(floppy_wq, &fd_timeout, delay);
682+
mod_delayed_work(floppy_wq, &fd_timeout, delay);
684683
if (UDP->flags & FD_DEBUG)
685684
DPRINT("reschedule timeout %s\n", message);
686685
timeout_message = message;
@@ -891,7 +890,7 @@ static void unlock_fdc(void)
891890

892891
raw_cmd = NULL;
893892
command_status = FD_COMMAND_NONE;
894-
__cancel_delayed_work(&fd_timeout);
893+
cancel_delayed_work(&fd_timeout);
895894
do_floppy = NULL;
896895
cont = NULL;
897896
clear_bit(0, &fdc_busy);

‎drivers/block/xen-blkfront.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ static void xlvbd_release_gendisk(struct blkfront_info *info)
670670
spin_unlock_irqrestore(&info->io_lock, flags);
671671

672672
/* Flush gnttab callback work. Must be done with no locks held. */
673-
flush_work_sync(&info->work);
673+
flush_work(&info->work);
674674

675675
del_gendisk(info->gd);
676676

@@ -719,7 +719,7 @@ static void blkif_free(struct blkfront_info *info, int suspend)
719719
spin_unlock_irq(&info->io_lock);
720720

721721
/* Flush gnttab callback work. Must be done with no locks held. */
722-
flush_work_sync(&info->work);
722+
flush_work(&info->work);
723723

724724
/* Free resources associated with old device channel. */
725725
if (info->ring_ref != GRANT_INVALID_REF) {

‎drivers/cdrom/gdrom.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ static int __devinit probe_gdrom(struct platform_device *devptr)
840840

841841
static int __devexit remove_gdrom(struct platform_device *devptr)
842842
{
843-
flush_work_sync(&work);
843+
flush_work(&work);
844844
blk_cleanup_queue(gd.gdrom_rq);
845845
free_irq(HW_EVENT_GDROM_CMD, &gd);
846846
free_irq(HW_EVENT_GDROM_DMA, &gd);

0 commit comments

Comments
 (0)