All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHSET] workqueue: update workqueue users - replace create_workqueue()
@ 2011-01-03 13:49 Tejun Heo
  2011-01-03 13:49 ` [PATCH 01/32] arm/omap: use system_wq in mailbox Tejun Heo
                   ` (32 more replies)
  0 siblings, 33 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel

Hello,

This patchset examines each user of create_workqueue() and update them
to better fit the new workqueue implementation.  For backward
compatibility, create_workqueue() is mapped to

 alloc_workqueue(@name, WQ_MEM_RECLAIM, 1)

but for a lot of its users, WQ_MEM_RECLAIM is not required,
@max_active of 1 is unnecessarily strict, or the dedicated workqueue
simply isn't needed.

* As the system workqueues can now host higher concurrency, a lot of
  users can drop dedicated workqueues and use the system ones.

* There are cases where keeping dedicated workqueues are necessary.
  e.g. They are depended upon during memory reclaim, need to be
  highpri or CPU intensive, serve work items which free themselves
  (and thus work items can't be explicitly queued), or need to limit
  max concurrency level from workqueue.  In these cases,
  alloc_workqueue() calls with better fitting parameters are used.

* This patchset mostly concentrates on converting create_workqueue()
  users but it also updates general workqueue usages when it makes
  sense to update them together.  Please read description of each
  patch for deatils.

This simplifies code, removes unnecessary rescuer kernel thread and
makes workqueue utilized more efficiently.

This patchset contains the following 32 patches.

 0001-arm-omap-use-system_wq-in-mailbox.patch
 0002-powerpc-cell-use-system_wq-in-cpufreq_spudemand.patch
 0003-block-make-kblockd_workqueue-smarter.patch
 0004-bio-integrity-mark-kintegrityd_wq-highpri-and-CPU-in.patch
 0005-crypto-mark-crypto-workqueues-CPU_INTENSIVE.patch
 0006-acpi-kacpi-_wq-don-t-need-WQ_MEM_RECLAIM.patch
 0007-cpufreq-use-system_wq-instead-of-dedicated-workqueue.patch
 0008-drm-nouveau-use-system_wq-instead-of-dev_priv-wq.patch
 0009-drm-radeon-use-system_wq-instead-of-dev_priv-wq.patch
 0010-input-tps6507x-ts-use-system_wq-instead-of-dedicated.patch
 0011-v4l-cx18-update-workqueue-usage.patch
 0012-i2o-use-alloc_workqueue-instead-of-create_workqueue.patch
 0013-misc-iwmc3200top-use-system_wq-instead-of-dedicated-.patch
 0014-wireless-ipw2x00-use-system_wq-instead-of-dedicated-.patch
 0015-wireless-libertas-_tf-use-system_wq-instead-of-dedic.patch
 0016-scsi-be2iscsi-qla2xxx-convert-to-alloc_workqueue.patch
 0017-scsi-ibmvstgt-use-system_wq-instead-of-vtgtd-workque.patch
 0018-scsi-scsi_tgt_lib-scsi_tgtd-isn-t-used-in-memory-rec.patch
 0019-usb-ueagle-atm-use-system_wq-instead-of-dedicated-wo.patch
 0020-video-msm_fb-use-system_wq-instead-of-dedicated-work.patch
 0021-fs-aio-aio_wq-isn-t-used-in-memory-reclaim-path.patch
 0022-ceph-fsc-_wq-s-aren-t-used-in-memory-reclaim-path.patch
 0023-net-ceph-make-ceph_msgr_wq-non-reentrant.patch
 0024-dlm-dlm-workqueues-aren-t-used-in-memory-reclaim-pat.patch
 0025-ext4-convert-to-alloc_workqueue.patch
 0026-ocfs2-use-system_wq-instead-of-ocfs2_quota_wq.patch
 0027-reiserfs-make-commit_wq-use-the-default-concurrency-.patch
 0028-xfs-convert-to-alloc_workqueue.patch
 0029-net-9p-use-system_wq-instead-of-p9_mux_wq.patch
 0030-net-9p-replace-p9_poll_task-with-a-work.patch
 0031-rds-ib-use-system_wq-instead-of-rds_ib_fmr_wq.patch
 0032-rxrpc-rxrpc_workqueue-isn-t-used-during-memory-recla.patch

The patches are based on 2.6.37-rc8 (b518a649) and available in the
following git branch.

 git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.g replace-create_workqueue

 arch/arm/plat-omap/mailbox.c                    |   10 -
 arch/powerpc/platforms/cell/cpufreq_spudemand.c |   20 --
 block/blk-core.c                                |    4
 crypto/crypto_wq.c                              |    3
 crypto/pcrypt.c                                 |    3
 drivers/acpi/osl.c                              |    6
 drivers/cpufreq/cpufreq_conservative.c          |   22 --
 drivers/cpufreq/cpufreq_ondemand.c              |   20 --
 drivers/gpu/drm/nouveau/nouveau_drv.h           |    1
 drivers/gpu/drm/nouveau/nouveau_irq.c           |    9 -
 drivers/gpu/drm/nouveau/nouveau_state.c         |   19 +-
 drivers/gpu/drm/nouveau/nv50_display.c          |    4
 drivers/gpu/drm/radeon/evergreen.c              |    2
 drivers/gpu/drm/radeon/r100.c                   |    2
 drivers/gpu/drm/radeon/r600.c                   |    2
 drivers/gpu/drm/radeon/radeon.h                 |    1
 drivers/gpu/drm/radeon/radeon_device.c          |    6
 drivers/gpu/drm/radeon/radeon_irq_kms.c         |    5
 drivers/gpu/drm/radeon/radeon_pm.c              |   47 +----
 drivers/gpu/drm/radeon/rs600.c                  |    2
 drivers/input/touchscreen/tps6507x-ts.c         |   12 -
 drivers/media/video/cx18/cx18-driver.c          |   24 --
 drivers/media/video/cx18/cx18-driver.h          |    3
 drivers/media/video/cx18/cx18-streams.h         |    3
 drivers/message/i2o/driver.c                    |    3
 drivers/misc/iwmc3200top/iwmc3200top.h          |    4
 drivers/misc/iwmc3200top/main.c                 |   14 -
 drivers/net/wireless/ipw2x00/ipw2100.c          |   70 +++-----
 drivers/net/wireless/ipw2x00/ipw2100.h          |    1
 drivers/net/wireless/ipw2x00/ipw2200.c          |  196 ++++++++++--------------
 drivers/net/wireless/ipw2x00/ipw2200.h          |    2
 drivers/net/wireless/libertas/if_sdio.c         |   10 -
 drivers/net/wireless/libertas_tf/cmd.c          |    6
 drivers/net/wireless/libertas_tf/libertas_tf.h  |    2
 drivers/net/wireless/libertas_tf/main.c         |   16 -
 drivers/scsi/be2iscsi/be_main.c                 |    2
 drivers/scsi/ibmvscsi/ibmvstgt.c                |   15 -
 drivers/scsi/qla2xxx/qla_os.c                   |    2
 drivers/scsi/scsi_tgt_lib.c                     |    2
 drivers/usb/atm/ueagle-atm.c                    |   19 --
 drivers/video/msm/msm_fb.c                      |   11 -
 fs/aio.c                                        |    4
 fs/bio-integrity.c                              |    7
 fs/ceph/super.c                                 |   10 -
 fs/dlm/lowcomms.c                               |   19 --
 fs/ext4/super.c                                 |    7
 fs/ocfs2/quota.h                                |    3
 fs/ocfs2/quota_global.c                         |   27 ---
 fs/ocfs2/super.c                                |    7
 fs/reiserfs/journal.c                           |    2
 fs/xfs/linux-2.6/xfs_buf.c                      |    5
 fs/xfs/xfs_mru_cache.c                          |    2
 include/linux/ceph/messenger.h                  |    5
 net/9p/trans_fd.c                               |   52 +-----
 net/ceph/messenger.c                            |   46 -----
 net/rds/ib.c                                    |    9 -
 net/rds/ib.h                                    |    2
 net/rds/ib_rdma.c                               |   27 ---
 net/rxrpc/af_rxrpc.c                            |    2
 59 files changed, 270 insertions(+), 571 deletions(-)

--
tejun

^ permalink raw reply	[flat|nested] 119+ messages in thread

* [PATCH 01/32] arm/omap: use system_wq in mailbox
  2011-01-03 13:49 [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
@ 2011-01-03 13:49 ` Tejun Heo
  2011-01-03 21:35   ` Kanigeri, Hari
  2011-01-03 13:49   ` Tejun Heo
                   ` (31 subsequent siblings)
  32 siblings, 1 reply; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Tejun Heo, Tony Lindgren, linux-omap

With cmwq, there's no reason to use a separate workqueue for mailbox.
Use the system_wq instead.  mbox->rxq->work is sync flushed in
omap_mbox_fini() to make sure it's not running on any cpu, which makes
sure that no mbox work is running when omap_mbox_exit() is entered.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Tony Lindgren <tony@atomide.com>
Cc: linux-omap@vger.kernel.org
---
Only compile tested.  Please feel free to take it into the subsystem
tree or simply ack - I'll route it through the wq tree.

Thanks.

 arch/arm/plat-omap/mailbox.c |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index d2fafb8..5bc4d7b 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -31,7 +31,6 @@
 
 #include <plat/mailbox.h>
 
-static struct workqueue_struct *mboxd;
 static struct omap_mbox **mboxes;
 static bool rq_full;
 
@@ -186,7 +185,7 @@ static void __mbox_rx_interrupt(struct omap_mbox *mbox)
 	/* no more messages in the fifo. clear IRQ source. */
 	ack_mbox_irq(mbox, IRQ_RX);
 nomem:
-	queue_work(mboxd, &mbox->rxq->work);
+	schedule_work(&mbox->rxq->work);
 }
 
 static irqreturn_t mbox_interrupt(int irq, void *p)
@@ -291,7 +290,7 @@ static void omap_mbox_fini(struct omap_mbox *mbox)
 {
 	free_irq(mbox->irq, mbox);
 	tasklet_kill(&mbox->txq->tasklet);
-	flush_work(&mbox->rxq->work);
+	flush_work_sync(&mbox->rxq->work);
 	mbox_queue_free(mbox->txq);
 	mbox_queue_free(mbox->rxq);
 
@@ -385,10 +384,6 @@ static int __init omap_mbox_init(void)
 	if (err)
 		return err;
 
-	mboxd = create_workqueue("mboxd");
-	if (!mboxd)
-		return -ENOMEM;
-
 	/* kfifo size sanity check: alignment and minimal size */
 	mbox_kfifo_size = ALIGN(mbox_kfifo_size, sizeof(mbox_msg_t));
 	mbox_kfifo_size = max_t(unsigned int, mbox_kfifo_size, sizeof(mbox_msg_t));
@@ -399,7 +394,6 @@ subsys_initcall(omap_mbox_init);
 
 static void __exit omap_mbox_exit(void)
 {
-	destroy_workqueue(mboxd);
 	class_unregister(&omap_mbox_class);
 }
 module_exit(omap_mbox_exit);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 119+ messages in thread

* [PATCH 02/32] powerpc/cell: use system_wq in cpufreq_spudemand
  2011-01-03 13:49 [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
@ 2011-01-03 13:49   ` Tejun Heo
  2011-01-03 13:49   ` Tejun Heo
                     ` (31 subsequent siblings)
  32 siblings, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Tejun Heo, Arnd Bergmann, linuxppc-dev, Dave Jones, cpufreq

With cmwq, there's no reason to use a separate workqueue in
cpufreq_spudemand.  Use system_wq instead.  The work items are already
sync canceled on stop, so it's already guaranteed that no work is
running when spu_gov_exit() is entered.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: Dave Jones <davej@redhat.com>
Cc: cpufreq@vger.kernel.org
---
Only compile tested.  Please feel free to take it into the subsystem
tree or simply ack - I'll route it through the wq tree.

Thanks.

 arch/powerpc/platforms/cell/cpufreq_spudemand.c |   20 +++-----------------
 1 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/arch/powerpc/platforms/cell/cpufreq_spudemand.c b/arch/powerpc/platforms/cell/cpufreq_spudemand.c
index 968c1c0..d809836 100644
--- a/arch/powerpc/platforms/cell/cpufreq_spudemand.c
+++ b/arch/powerpc/platforms/cell/cpufreq_spudemand.c
@@ -39,8 +39,6 @@ struct spu_gov_info_struct {
 };
 static DEFINE_PER_CPU(struct spu_gov_info_struct, spu_gov_info);
 
-static struct workqueue_struct *kspugov_wq;
-
 static int calc_freq(struct spu_gov_info_struct *info)
 {
 	int cpu;
@@ -71,14 +69,14 @@ static void spu_gov_work(struct work_struct *work)
 	__cpufreq_driver_target(info->policy, target_freq, CPUFREQ_RELATION_H);
 
 	delay = usecs_to_jiffies(info->poll_int);
-	queue_delayed_work_on(info->policy->cpu, kspugov_wq, &info->work, delay);
+	schedule_delayed_work_on(info->policy->cpu, &info->work, delay);
 }
 
 static void spu_gov_init_work(struct spu_gov_info_struct *info)
 {
 	int delay = usecs_to_jiffies(info->poll_int);
 	INIT_DELAYED_WORK_DEFERRABLE(&info->work, spu_gov_work);
-	queue_delayed_work_on(info->policy->cpu, kspugov_wq, &info->work, delay);
+	schedule_delayed_work_on(info->policy->cpu, &info->work, delay);
 }
 
 static void spu_gov_cancel_work(struct spu_gov_info_struct *info)
@@ -152,27 +150,15 @@ static int __init spu_gov_init(void)
 {
 	int ret;
 
-	kspugov_wq = create_workqueue("kspugov");
-	if (!kspugov_wq) {
-		printk(KERN_ERR "creation of kspugov failed\n");
-		ret = -EFAULT;
-		goto out;
-	}
-
 	ret = cpufreq_register_governor(&spu_governor);
-	if (ret) {
+	if (ret)
 		printk(KERN_ERR "registration of governor failed\n");
-		destroy_workqueue(kspugov_wq);
-		goto out;
-	}
-out:
 	return ret;
 }
 
 static void __exit spu_gov_exit(void)
 {
 	cpufreq_unregister_governor(&spu_governor);
-	destroy_workqueue(kspugov_wq);
 }
 
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 119+ messages in thread

* [PATCH 02/32] powerpc/cell: use system_wq in cpufreq_spudemand
@ 2011-01-03 13:49   ` Tejun Heo
  0 siblings, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Tejun Heo, Dave Jones, linuxppc-dev, cpufreq, Arnd Bergmann

With cmwq, there's no reason to use a separate workqueue in
cpufreq_spudemand.  Use system_wq instead.  The work items are already
sync canceled on stop, so it's already guaranteed that no work is
running when spu_gov_exit() is entered.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: Dave Jones <davej@redhat.com>
Cc: cpufreq@vger.kernel.org
---
Only compile tested.  Please feel free to take it into the subsystem
tree or simply ack - I'll route it through the wq tree.

Thanks.

 arch/powerpc/platforms/cell/cpufreq_spudemand.c |   20 +++-----------------
 1 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/arch/powerpc/platforms/cell/cpufreq_spudemand.c b/arch/powerpc/platforms/cell/cpufreq_spudemand.c
index 968c1c0..d809836 100644
--- a/arch/powerpc/platforms/cell/cpufreq_spudemand.c
+++ b/arch/powerpc/platforms/cell/cpufreq_spudemand.c
@@ -39,8 +39,6 @@ struct spu_gov_info_struct {
 };
 static DEFINE_PER_CPU(struct spu_gov_info_struct, spu_gov_info);
 
-static struct workqueue_struct *kspugov_wq;
-
 static int calc_freq(struct spu_gov_info_struct *info)
 {
 	int cpu;
@@ -71,14 +69,14 @@ static void spu_gov_work(struct work_struct *work)
 	__cpufreq_driver_target(info->policy, target_freq, CPUFREQ_RELATION_H);
 
 	delay = usecs_to_jiffies(info->poll_int);
-	queue_delayed_work_on(info->policy->cpu, kspugov_wq, &info->work, delay);
+	schedule_delayed_work_on(info->policy->cpu, &info->work, delay);
 }
 
 static void spu_gov_init_work(struct spu_gov_info_struct *info)
 {
 	int delay = usecs_to_jiffies(info->poll_int);
 	INIT_DELAYED_WORK_DEFERRABLE(&info->work, spu_gov_work);
-	queue_delayed_work_on(info->policy->cpu, kspugov_wq, &info->work, delay);
+	schedule_delayed_work_on(info->policy->cpu, &info->work, delay);
 }
 
 static void spu_gov_cancel_work(struct spu_gov_info_struct *info)
@@ -152,27 +150,15 @@ static int __init spu_gov_init(void)
 {
 	int ret;
 
-	kspugov_wq = create_workqueue("kspugov");
-	if (!kspugov_wq) {
-		printk(KERN_ERR "creation of kspugov failed\n");
-		ret = -EFAULT;
-		goto out;
-	}
-
 	ret = cpufreq_register_governor(&spu_governor);
-	if (ret) {
+	if (ret)
 		printk(KERN_ERR "registration of governor failed\n");
-		destroy_workqueue(kspugov_wq);
-		goto out;
-	}
-out:
 	return ret;
 }
 
 static void __exit spu_gov_exit(void)
 {
 	cpufreq_unregister_governor(&spu_governor);
-	destroy_workqueue(kspugov_wq);
 }
 
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 119+ messages in thread

* [PATCH 03/32] block: make kblockd_workqueue smarter
  2011-01-03 13:49 [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
  2011-01-03 13:49 ` [PATCH 01/32] arm/omap: use system_wq in mailbox Tejun Heo
  2011-01-03 13:49   ` Tejun Heo
@ 2011-01-03 13:49 ` Tejun Heo
  2011-01-03 14:00   ` Jens Axboe
  2011-01-03 13:49 ` [PATCH 04/32] bio-integrity: mark kintegrityd_wq highpri and CPU intensive Tejun Heo
                   ` (29 subsequent siblings)
  32 siblings, 1 reply; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Tejun Heo, Jens Axboe

kblockd is used for unplugging and may affect IO latency and
throughput and the max number of concurrent work items are bound by
the number of block devices.  Make it HIGHPRI workqueue w/ default max
concurrency.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>
---
Please feel free to take it into the subsystem tree or simply ack -
I'll route it through the wq tree.

Thanks.

 block/blk-core.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 4ce953f..909b84a 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -2606,7 +2606,9 @@ int __init blk_dev_init(void)
 	BUILD_BUG_ON(__REQ_NR_BITS > 8 *
 			sizeof(((struct request *)0)->cmd_flags));
 
-	kblockd_workqueue = create_workqueue("kblockd");
+	/* used for unplugging and affects IO latency/throughput - HIGHPRI */
+	kblockd_workqueue = alloc_workqueue("kblockd",
+					    WQ_MEM_RECLAIM | WQ_HIGHPRI, 0);
 	if (!kblockd_workqueue)
 		panic("Failed to create kblockd\n");
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 119+ messages in thread

* [PATCH 04/32] bio-integrity: mark kintegrityd_wq highpri and CPU intensive
  2011-01-03 13:49 [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
                   ` (2 preceding siblings ...)
  2011-01-03 13:49 ` [PATCH 03/32] block: make kblockd_workqueue smarter Tejun Heo
@ 2011-01-03 13:49 ` Tejun Heo
  2011-01-03 13:49   ` Tejun Heo
                   ` (28 subsequent siblings)
  32 siblings, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Tejun Heo, Jens Axboe, Martin K. Petersen

Work items processed by kintegrityd_wq won't block much, may burn a
lot of CPU cycles and affect IO latency.  Use alloc_workqueue() to
mark it highpri and CPU intensive with max concurrency of 1.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
---
Only compile tested.  Please feel free to take it into the subsystem
tree or simply ack - I'll route it through the wq tree.

Thanks.

 fs/bio-integrity.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/fs/bio-integrity.c b/fs/bio-integrity.c
index 4d0ff5e..e49cce2 100644
--- a/fs/bio-integrity.c
+++ b/fs/bio-integrity.c
@@ -782,7 +782,12 @@ void __init bio_integrity_init(void)
 {
 	unsigned int i;
 
-	kintegrityd_wq = create_workqueue("kintegrityd");
+	/*
+	 * kintegrityd won't block much but may burn a lot of CPU cycles.
+	 * Make it highpri CPU intensive wq with max concurrency of 1.
+	 */
+	kintegrityd_wq = alloc_workqueue("kintegrityd", WQ_MEM_RECLAIM |
+					 WQ_HIGHPRI | WQ_CPU_INTENSIVE, 1);
 	if (!kintegrityd_wq)
 		panic("Failed to create kintegrityd\n");
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 119+ messages in thread

* [PATCH 05/32] crypto: mark crypto workqueues CPU_INTENSIVE
  2011-01-03 13:49 [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
@ 2011-01-03 13:49   ` Tejun Heo
  2011-01-03 13:49   ` Tejun Heo
                     ` (31 subsequent siblings)
  32 siblings, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Tejun Heo, Herbert Xu, David S. Miller, linux-crypto

kcrypto_wq and pcrypt->wq's are used to run ciphers and may consume
considerable amount of CPU cycles.  Mark both as CPU_INTENSIVE so that
they don't block other work items.

As the workqueues are primarily used to burn CPU cycles, concurrency
levels shouldn't matter much and are left at 1.  A higher value may be
beneficial and needs investigation.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: linux-crypto@vger.kernel.org
---
Only compile tested.  Please feel free to take it into the subsystem
tree or simply ack - I'll route it through the wq tree.

Thanks.

 crypto/crypto_wq.c |    3 ++-
 crypto/pcrypt.c    |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/crypto/crypto_wq.c b/crypto/crypto_wq.c
index fdcf624..b980ee1 100644
--- a/crypto/crypto_wq.c
+++ b/crypto/crypto_wq.c
@@ -20,7 +20,8 @@ EXPORT_SYMBOL_GPL(kcrypto_wq);
 
 static int __init crypto_wq_init(void)
 {
-	kcrypto_wq = create_workqueue("crypto");
+	kcrypto_wq = alloc_workqueue("crypto",
+				     WQ_MEM_RECLAIM | WQ_CPU_INTENSIVE, 1);
 	if (unlikely(!kcrypto_wq))
 		return -ENOMEM;
 	return 0;
diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c
index 75586f1..29a89da 100644
--- a/crypto/pcrypt.c
+++ b/crypto/pcrypt.c
@@ -455,7 +455,8 @@ static int pcrypt_init_padata(struct padata_pcrypt *pcrypt,
 
 	get_online_cpus();
 
-	pcrypt->wq = create_workqueue(name);
+	pcrypt->wq = alloc_workqueue(name,
+				     WQ_MEM_RECLAIM | WQ_CPU_INTENSIVE, 1);
 	if (!pcrypt->wq)
 		goto err;
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 119+ messages in thread

* [PATCH 05/32] crypto: mark crypto workqueues CPU_INTENSIVE
@ 2011-01-03 13:49   ` Tejun Heo
  0 siblings, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Tejun Heo, Herbert Xu, David S. Miller, linux-crypto

kcrypto_wq and pcrypt->wq's are used to run ciphers and may consume
considerable amount of CPU cycles.  Mark both as CPU_INTENSIVE so that
they don't block other work items.

As the workqueues are primarily used to burn CPU cycles, concurrency
levels shouldn't matter much and are left at 1.  A higher value may be
beneficial and needs investigation.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: linux-crypto@vger.kernel.org
---
Only compile tested.  Please feel free to take it into the subsystem
tree or simply ack - I'll route it through the wq tree.

Thanks.

 crypto/crypto_wq.c |    3 ++-
 crypto/pcrypt.c    |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/crypto/crypto_wq.c b/crypto/crypto_wq.c
index fdcf624..b980ee1 100644
--- a/crypto/crypto_wq.c
+++ b/crypto/crypto_wq.c
@@ -20,7 +20,8 @@ EXPORT_SYMBOL_GPL(kcrypto_wq);
 
 static int __init crypto_wq_init(void)
 {
-	kcrypto_wq = create_workqueue("crypto");
+	kcrypto_wq = alloc_workqueue("crypto",
+				     WQ_MEM_RECLAIM | WQ_CPU_INTENSIVE, 1);
 	if (unlikely(!kcrypto_wq))
 		return -ENOMEM;
 	return 0;
diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c
index 75586f1..29a89da 100644
--- a/crypto/pcrypt.c
+++ b/crypto/pcrypt.c
@@ -455,7 +455,8 @@ static int pcrypt_init_padata(struct padata_pcrypt *pcrypt,
 
 	get_online_cpus();
 
-	pcrypt->wq = create_workqueue(name);
+	pcrypt->wq = alloc_workqueue(name,
+				     WQ_MEM_RECLAIM | WQ_CPU_INTENSIVE, 1);
 	if (!pcrypt->wq)
 		goto err;
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 119+ messages in thread

* [PATCH 06/32] acpi: kacpi*_wq don't need WQ_MEM_RECLAIM
  2011-01-03 13:49 [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
                   ` (4 preceding siblings ...)
  2011-01-03 13:49   ` Tejun Heo
@ 2011-01-03 13:49 ` Tejun Heo
  2011-01-03 13:49 ` [PATCH 07/32] cpufreq: use system_wq instead of dedicated workqueues Tejun Heo
                   ` (26 subsequent siblings)
  32 siblings, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Tejun Heo, Len Brown, linux-acpi

ACPI workqueues aren't used during memory reclaming.  Use
alloc_workqueue() to create workqueues w/o rescuers.

If the purpose of the separation between kacpid_wq and kacpi_notify_wq
was to give notifications better response time, kacpi_notify_wq can be
dropped and kacpi_wq can be created with higher @max_active.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Len Brown <lenb@kernel.org>
Cc: linux-acpi@vger.kernel.org
---
Only compile tested.  Please feel free to take it into the subsystem
tree or simply ack - I'll route it through the wq tree.

Thanks.

 drivers/acpi/osl.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 055d7b7..c961e18 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -1573,9 +1573,9 @@ acpi_status __init acpi_os_initialize(void)
 
 acpi_status __init acpi_os_initialize1(void)
 {
-	kacpid_wq = create_workqueue("kacpid");
-	kacpi_notify_wq = create_workqueue("kacpi_notify");
-	kacpi_hotplug_wq = create_workqueue("kacpi_hotplug");
+	kacpid_wq = alloc_workqueue("kacpid", 0, 1);
+	kacpi_notify_wq = alloc_workqueue("kacpi_notify", 0, 1);
+	kacpi_hotplug_wq = alloc_workqueue("kacpi_hotplug", 0, 1);
 	BUG_ON(!kacpid_wq);
 	BUG_ON(!kacpi_notify_wq);
 	BUG_ON(!kacpi_hotplug_wq);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 119+ messages in thread

* [PATCH 07/32] cpufreq: use system_wq instead of dedicated workqueues
  2011-01-03 13:49 [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
                   ` (5 preceding siblings ...)
  2011-01-03 13:49 ` [PATCH 06/32] acpi: kacpi*_wq don't need WQ_MEM_RECLAIM Tejun Heo
@ 2011-01-03 13:49 ` Tejun Heo
  2011-01-03 13:49   ` Tejun Heo
                   ` (25 subsequent siblings)
  32 siblings, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Tejun Heo, Dave Jones, cpufreq

With cmwq, there's no reason for cpufreq drivers to use separate
workqueues.  Remove the dedicated workqueues from cpufreq_conservative
and cpufreq_ondemand and use system_wq instead.  The work items are
already sync canceled on stop, so it's already guaranteed that no work
is running on module exit.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Dave Jones <davej@redhat.com>
Cc: cpufreq@vger.kernel.org
---
Only compile tested.  Please feel free to take it into the subsystem
tree or simply ack - I'll route it through the wq tree.

Thanks.

 drivers/cpufreq/cpufreq_conservative.c |   22 +++-------------------
 drivers/cpufreq/cpufreq_ondemand.c     |   20 +++-----------------
 2 files changed, 6 insertions(+), 36 deletions(-)

diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c
index 526bfbf..94284c8 100644
--- a/drivers/cpufreq/cpufreq_conservative.c
+++ b/drivers/cpufreq/cpufreq_conservative.c
@@ -81,8 +81,6 @@ static unsigned int dbs_enable;	/* number of CPUs using this policy */
  */
 static DEFINE_MUTEX(dbs_mutex);
 
-static struct workqueue_struct	*kconservative_wq;
-
 static struct dbs_tuners {
 	unsigned int sampling_rate;
 	unsigned int sampling_down_factor;
@@ -560,7 +558,7 @@ static void do_dbs_timer(struct work_struct *work)
 
 	dbs_check_cpu(dbs_info);
 
-	queue_delayed_work_on(cpu, kconservative_wq, &dbs_info->work, delay);
+	schedule_delayed_work_on(cpu, &dbs_info->work, delay);
 	mutex_unlock(&dbs_info->timer_mutex);
 }
 
@@ -572,8 +570,7 @@ static inline void dbs_timer_init(struct cpu_dbs_info_s *dbs_info)
 
 	dbs_info->enable = 1;
 	INIT_DELAYED_WORK_DEFERRABLE(&dbs_info->work, do_dbs_timer);
-	queue_delayed_work_on(dbs_info->cpu, kconservative_wq, &dbs_info->work,
-				delay);
+	schedule_delayed_work_on(dbs_info->cpu, &dbs_info->work, delay);
 }
 
 static inline void dbs_timer_exit(struct cpu_dbs_info_s *dbs_info)
@@ -716,25 +713,12 @@ struct cpufreq_governor cpufreq_gov_conservative = {
 
 static int __init cpufreq_gov_dbs_init(void)
 {
-	int err;
-
-	kconservative_wq = create_workqueue("kconservative");
-	if (!kconservative_wq) {
-		printk(KERN_ERR "Creation of kconservative failed\n");
-		return -EFAULT;
-	}
-
-	err = cpufreq_register_governor(&cpufreq_gov_conservative);
-	if (err)
-		destroy_workqueue(kconservative_wq);
-
-	return err;
+	return cpufreq_register_governor(&cpufreq_gov_conservative);
 }
 
 static void __exit cpufreq_gov_dbs_exit(void)
 {
 	cpufreq_unregister_governor(&cpufreq_gov_conservative);
-	destroy_workqueue(kconservative_wq);
 }
 
 
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index c631f27..58aa85e 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -104,8 +104,6 @@ static unsigned int dbs_enable;	/* number of CPUs using this policy */
  */
 static DEFINE_MUTEX(dbs_mutex);
 
-static struct workqueue_struct	*kondemand_wq;
-
 static struct dbs_tuners {
 	unsigned int sampling_rate;
 	unsigned int up_threshold;
@@ -667,7 +665,7 @@ static void do_dbs_timer(struct work_struct *work)
 		__cpufreq_driver_target(dbs_info->cur_policy,
 			dbs_info->freq_lo, CPUFREQ_RELATION_H);
 	}
-	queue_delayed_work_on(cpu, kondemand_wq, &dbs_info->work, delay);
+	schedule_delayed_work_on(cpu, &dbs_info->work, delay);
 	mutex_unlock(&dbs_info->timer_mutex);
 }
 
@@ -681,8 +679,7 @@ static inline void dbs_timer_init(struct cpu_dbs_info_s *dbs_info)
 
 	dbs_info->sample_type = DBS_NORMAL_SAMPLE;
 	INIT_DELAYED_WORK_DEFERRABLE(&dbs_info->work, do_dbs_timer);
-	queue_delayed_work_on(dbs_info->cpu, kondemand_wq, &dbs_info->work,
-		delay);
+	schedule_delayed_work_on(dbs_info->cpu, &dbs_info->work, delay);
 }
 
 static inline void dbs_timer_exit(struct cpu_dbs_info_s *dbs_info)
@@ -814,7 +811,6 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
 
 static int __init cpufreq_gov_dbs_init(void)
 {
-	int err;
 	cputime64_t wall;
 	u64 idle_time;
 	int cpu = get_cpu();
@@ -838,22 +834,12 @@ static int __init cpufreq_gov_dbs_init(void)
 			MIN_SAMPLING_RATE_RATIO * jiffies_to_usecs(10);
 	}
 
-	kondemand_wq = create_workqueue("kondemand");
-	if (!kondemand_wq) {
-		printk(KERN_ERR "Creation of kondemand failed\n");
-		return -EFAULT;
-	}
-	err = cpufreq_register_governor(&cpufreq_gov_ondemand);
-	if (err)
-		destroy_workqueue(kondemand_wq);
-
-	return err;
+	return cpufreq_register_governor(&cpufreq_gov_ondemand);
 }
 
 static void __exit cpufreq_gov_dbs_exit(void)
 {
 	cpufreq_unregister_governor(&cpufreq_gov_ondemand);
-	destroy_workqueue(kondemand_wq);
 }
 
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 119+ messages in thread

* [PATCH 08/32] drm/nouveau: use system_wq instead of dev_priv->wq
  2011-01-03 13:49 [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
@ 2011-01-03 13:49   ` Tejun Heo
  2011-01-03 13:49   ` Tejun Heo
                     ` (31 subsequent siblings)
  32 siblings, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Tejun Heo, David Airlie, dri-devel

With cmwq, there's no reason for nouveau to use a dedicated workqueue.
Drop dev_priv->wq and use system_wq instead.

Because nouveau_irq_uninstall() may be called from unsleepable
context, the work items can't be flushed from there.  Instead, init
and flush from nouveau_load/unload().

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
---
Only compile tested.  Please feel free to take it into the subsystem
tree or simply ack - I'll route it through the wq tree.

Thanks.

 drivers/gpu/drm/nouveau/nouveau_drv.h   |    1 -
 drivers/gpu/drm/nouveau/nouveau_irq.c   |    9 ---------
 drivers/gpu/drm/nouveau/nouveau_state.c |   19 ++++++++++---------
 drivers/gpu/drm/nouveau/nv50_display.c  |    4 ++--
 4 files changed, 12 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h
index 1c7db64..2ecf875 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -580,7 +580,6 @@ struct drm_nouveau_private {
 
 	struct nouveau_bo *vga_ram;
 
-	struct workqueue_struct *wq;
 	struct work_struct irq_work;
 	struct work_struct hpd_work;
 
diff --git a/drivers/gpu/drm/nouveau/nouveau_irq.c b/drivers/gpu/drm/nouveau/nouveau_irq.c
index 7bfd9e6..7d05a06 100644
--- a/drivers/gpu/drm/nouveau/nouveau_irq.c
+++ b/drivers/gpu/drm/nouveau/nouveau_irq.c
@@ -52,17 +52,8 @@ static int nouveau_ratelimit(void)
 void
 nouveau_irq_preinstall(struct drm_device *dev)
 {
-	struct drm_nouveau_private *dev_priv = dev->dev_private;
-
 	/* Master disable */
 	nv_wr32(dev, NV03_PMC_INTR_EN_0, 0);
-
-	if (dev_priv->card_type >= NV_50) {
-		INIT_WORK(&dev_priv->irq_work, nv50_display_irq_handler_bh);
-		INIT_WORK(&dev_priv->hpd_work, nv50_display_irq_hotplug_bh);
-		spin_lock_init(&dev_priv->hpd_state.lock);
-		INIT_LIST_HEAD(&dev_priv->vbl_waiting);
-	}
 }
 
 int
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c
index 049f755..2eea6ea 100644
--- a/drivers/gpu/drm/nouveau/nouveau_state.c
+++ b/drivers/gpu/drm/nouveau/nouveau_state.c
@@ -839,17 +839,17 @@ int nouveau_load(struct drm_device *dev, unsigned long flags)
 	dev->dev_private = dev_priv;
 	dev_priv->dev = dev;
 
+	/* the followings are used only by >= NV_50 */
+	INIT_WORK(&dev_priv->irq_work, nv50_display_irq_handler_bh);
+	INIT_WORK(&dev_priv->hpd_work, nv50_display_irq_hotplug_bh);
+	spin_lock_init(&dev_priv->hpd_state.lock);
+	INIT_LIST_HEAD(&dev_priv->vbl_waiting);
+
 	dev_priv->flags = flags & NOUVEAU_FLAGS;
 
 	NV_DEBUG(dev, "vendor: 0x%X device: 0x%X class: 0x%X\n",
 		 dev->pci_vendor, dev->pci_device, dev->pdev->class);
 
-	dev_priv->wq = create_workqueue("nouveau");
-	if (!dev_priv->wq) {
-		ret = -EINVAL;
-		goto err_priv;
-	}
-
 	/* resource 0 is mmio regs */
 	/* resource 1 is linear FB */
 	/* resource 2 is RAMIN (mmio regs + 0x1000000) */
@@ -862,7 +862,7 @@ int nouveau_load(struct drm_device *dev, unsigned long flags)
 		NV_ERROR(dev, "Unable to initialize the mmio mapping. "
 			 "Please report your setup to " DRIVER_EMAIL "\n");
 		ret = -EINVAL;
-		goto err_wq;
+		goto err_priv;
 	}
 	NV_DEBUG(dev, "regs mapped ok at 0x%llx\n",
 					(unsigned long long)mmio_start_offs);
@@ -969,8 +969,6 @@ err_ramin:
 	iounmap(dev_priv->ramin);
 err_mmio:
 	iounmap(dev_priv->mmio);
-err_wq:
-	destroy_workqueue(dev_priv->wq);
 err_priv:
 	kfree(dev_priv);
 	dev->dev_private = NULL;
@@ -992,6 +990,9 @@ int nouveau_unload(struct drm_device *dev)
 	engine->display.destroy(dev);
 	nouveau_card_takedown(dev);
 
+	flush_work_sync(&dev_priv->irq_work);
+	flush_work_sync(&dev_priv->hpd_work);
+
 	iounmap(dev_priv->mmio);
 	iounmap(dev_priv->ramin);
 
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index f624c61..3d569da 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -1110,7 +1110,7 @@ nv50_display_irq_handler(struct drm_device *dev)
 		dev_priv->hpd_state.hpd1_bits |= hpd1_bits;
 		spin_unlock(&dev_priv->hpd_state.lock);
 
-		queue_work(dev_priv->wq, &dev_priv->hpd_work);
+		schedule_work(&dev_priv->hpd_work);
 	}
 
 	while (nv_rd32(dev, NV50_PMC_INTR_0) & NV50_PMC_INTR_0_DISPLAY) {
@@ -1139,7 +1139,7 @@ nv50_display_irq_handler(struct drm_device *dev)
 		if (clock) {
 			nv_wr32(dev, NV03_PMC_INTR_EN_0, 0);
 			if (!work_pending(&dev_priv->irq_work))
-				queue_work(dev_priv->wq, &dev_priv->irq_work);
+				schedule_work(&dev_priv->irq_work);
 			delayed |= clock;
 			intr1 &= ~clock;
 		}
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 119+ messages in thread

* [PATCH 08/32] drm/nouveau: use system_wq instead of dev_priv->wq
@ 2011-01-03 13:49   ` Tejun Heo
  0 siblings, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Tejun Heo, dri-devel

With cmwq, there's no reason for nouveau to use a dedicated workqueue.
Drop dev_priv->wq and use system_wq instead.

Because nouveau_irq_uninstall() may be called from unsleepable
context, the work items can't be flushed from there.  Instead, init
and flush from nouveau_load/unload().

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
---
Only compile tested.  Please feel free to take it into the subsystem
tree or simply ack - I'll route it through the wq tree.

Thanks.

 drivers/gpu/drm/nouveau/nouveau_drv.h   |    1 -
 drivers/gpu/drm/nouveau/nouveau_irq.c   |    9 ---------
 drivers/gpu/drm/nouveau/nouveau_state.c |   19 ++++++++++---------
 drivers/gpu/drm/nouveau/nv50_display.c  |    4 ++--
 4 files changed, 12 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h
index 1c7db64..2ecf875 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -580,7 +580,6 @@ struct drm_nouveau_private {
 
 	struct nouveau_bo *vga_ram;
 
-	struct workqueue_struct *wq;
 	struct work_struct irq_work;
 	struct work_struct hpd_work;
 
diff --git a/drivers/gpu/drm/nouveau/nouveau_irq.c b/drivers/gpu/drm/nouveau/nouveau_irq.c
index 7bfd9e6..7d05a06 100644
--- a/drivers/gpu/drm/nouveau/nouveau_irq.c
+++ b/drivers/gpu/drm/nouveau/nouveau_irq.c
@@ -52,17 +52,8 @@ static int nouveau_ratelimit(void)
 void
 nouveau_irq_preinstall(struct drm_device *dev)
 {
-	struct drm_nouveau_private *dev_priv = dev->dev_private;
-
 	/* Master disable */
 	nv_wr32(dev, NV03_PMC_INTR_EN_0, 0);
-
-	if (dev_priv->card_type >= NV_50) {
-		INIT_WORK(&dev_priv->irq_work, nv50_display_irq_handler_bh);
-		INIT_WORK(&dev_priv->hpd_work, nv50_display_irq_hotplug_bh);
-		spin_lock_init(&dev_priv->hpd_state.lock);
-		INIT_LIST_HEAD(&dev_priv->vbl_waiting);
-	}
 }
 
 int
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c
index 049f755..2eea6ea 100644
--- a/drivers/gpu/drm/nouveau/nouveau_state.c
+++ b/drivers/gpu/drm/nouveau/nouveau_state.c
@@ -839,17 +839,17 @@ int nouveau_load(struct drm_device *dev, unsigned long flags)
 	dev->dev_private = dev_priv;
 	dev_priv->dev = dev;
 
+	/* the followings are used only by >= NV_50 */
+	INIT_WORK(&dev_priv->irq_work, nv50_display_irq_handler_bh);
+	INIT_WORK(&dev_priv->hpd_work, nv50_display_irq_hotplug_bh);
+	spin_lock_init(&dev_priv->hpd_state.lock);
+	INIT_LIST_HEAD(&dev_priv->vbl_waiting);
+
 	dev_priv->flags = flags & NOUVEAU_FLAGS;
 
 	NV_DEBUG(dev, "vendor: 0x%X device: 0x%X class: 0x%X\n",
 		 dev->pci_vendor, dev->pci_device, dev->pdev->class);
 
-	dev_priv->wq = create_workqueue("nouveau");
-	if (!dev_priv->wq) {
-		ret = -EINVAL;
-		goto err_priv;
-	}
-
 	/* resource 0 is mmio regs */
 	/* resource 1 is linear FB */
 	/* resource 2 is RAMIN (mmio regs + 0x1000000) */
@@ -862,7 +862,7 @@ int nouveau_load(struct drm_device *dev, unsigned long flags)
 		NV_ERROR(dev, "Unable to initialize the mmio mapping. "
 			 "Please report your setup to " DRIVER_EMAIL "\n");
 		ret = -EINVAL;
-		goto err_wq;
+		goto err_priv;
 	}
 	NV_DEBUG(dev, "regs mapped ok at 0x%llx\n",
 					(unsigned long long)mmio_start_offs);
@@ -969,8 +969,6 @@ err_ramin:
 	iounmap(dev_priv->ramin);
 err_mmio:
 	iounmap(dev_priv->mmio);
-err_wq:
-	destroy_workqueue(dev_priv->wq);
 err_priv:
 	kfree(dev_priv);
 	dev->dev_private = NULL;
@@ -992,6 +990,9 @@ int nouveau_unload(struct drm_device *dev)
 	engine->display.destroy(dev);
 	nouveau_card_takedown(dev);
 
+	flush_work_sync(&dev_priv->irq_work);
+	flush_work_sync(&dev_priv->hpd_work);
+
 	iounmap(dev_priv->mmio);
 	iounmap(dev_priv->ramin);
 
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index f624c61..3d569da 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -1110,7 +1110,7 @@ nv50_display_irq_handler(struct drm_device *dev)
 		dev_priv->hpd_state.hpd1_bits |= hpd1_bits;
 		spin_unlock(&dev_priv->hpd_state.lock);
 
-		queue_work(dev_priv->wq, &dev_priv->hpd_work);
+		schedule_work(&dev_priv->hpd_work);
 	}
 
 	while (nv_rd32(dev, NV50_PMC_INTR_0) & NV50_PMC_INTR_0_DISPLAY) {
@@ -1139,7 +1139,7 @@ nv50_display_irq_handler(struct drm_device *dev)
 		if (clock) {
 			nv_wr32(dev, NV03_PMC_INTR_EN_0, 0);
 			if (!work_pending(&dev_priv->irq_work))
-				queue_work(dev_priv->wq, &dev_priv->irq_work);
+				schedule_work(&dev_priv->irq_work);
 			delayed |= clock;
 			intr1 &= ~clock;
 		}
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 119+ messages in thread

* [PATCH 09/32] drm/radeon: use system_wq instead of dev_priv->wq
  2011-01-03 13:49 [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
@ 2011-01-03 13:49   ` Tejun Heo
  2011-01-03 13:49   ` Tejun Heo
                     ` (31 subsequent siblings)
  32 siblings, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Tejun Heo, David Airlie, dri-devel

With cmwq, there's no reason for radeon to use a dedicated workqueue.
Drop dev_priv->wq and use system_wq instead.

Because radeon_driver_irq_uninstall_kms() may be called from
unsleepable context, the work items can't be flushed from there.
Instead, init and flush from radeon_irq_kms_init/fini().

While at it, simplify canceling/flushing of rdev->pm.dynpm_idle_work.
Always initialize and sync cancel instead of being unnecessarily smart
about it.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
---
Only compile tested.  Please feel free to take it into the subsystem
tree or simply ack - I'll route it through the wq tree.

Thanks.

 drivers/gpu/drm/radeon/evergreen.c      |    2 +-
 drivers/gpu/drm/radeon/r100.c           |    2 +-
 drivers/gpu/drm/radeon/r600.c           |    2 +-
 drivers/gpu/drm/radeon/radeon.h         |    1 -
 drivers/gpu/drm/radeon/radeon_device.c  |    6 ----
 drivers/gpu/drm/radeon/radeon_irq_kms.c |    5 ++-
 drivers/gpu/drm/radeon/radeon_pm.c      |   47 ++++++++++--------------------
 drivers/gpu/drm/radeon/rs600.c          |    2 +-
 8 files changed, 23 insertions(+), 44 deletions(-)

diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index 7b337c3..6540adb 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -2516,7 +2516,7 @@ restart_ih:
 	if (wptr != rdev->ih.wptr)
 		goto restart_ih;
 	if (queue_hotplug)
-		queue_work(rdev->wq, &rdev->hotplug_work);
+		schedule_work(&rdev->hotplug_work);
 	rdev->ih.rptr = rptr;
 	WREG32(IH_RB_RPTR, rdev->ih.rptr);
 	spin_unlock_irqrestore(&rdev->ih.lock, flags);
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index 8e10aa9..1d15748 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -622,7 +622,7 @@ int r100_irq_process(struct radeon_device *rdev)
 	/* reset gui idle ack.  the status bit is broken */
 	rdev->irq.gui_idle_acked = false;
 	if (queue_hotplug)
-		queue_work(rdev->wq, &rdev->hotplug_work);
+		schedule_work(&rdev->hotplug_work);
 	if (rdev->msi_enabled) {
 		switch (rdev->family) {
 		case CHIP_RS400:
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 9c92db7..f927cd4 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -3419,7 +3419,7 @@ restart_ih:
 	if (wptr != rdev->ih.wptr)
 		goto restart_ih;
 	if (queue_hotplug)
-		queue_work(rdev->wq, &rdev->hotplug_work);
+		schedule_work(&rdev->hotplug_work);
 	rdev->ih.rptr = rptr;
 	WREG32(IH_RB_RPTR, rdev->ih.rptr);
 	spin_unlock_irqrestore(&rdev->ih.lock, flags);
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 3a70957..ba233a8 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -1095,7 +1095,6 @@ struct radeon_device {
 	struct r700_vram_scratch vram_scratch;
 	int msi_enabled; /* msi enabled */
 	struct r600_ih ih; /* r6/700 interrupt ring */
-	struct workqueue_struct *wq;
 	struct work_struct hotplug_work;
 	int num_crtc; /* number of crtcs */
 	struct mutex dc_hw_i2c_mutex; /* display controller hw i2c mutex */
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 501966a..4bc0012 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -704,11 +704,6 @@ int radeon_device_init(struct radeon_device *rdev,
 	init_waitqueue_head(&rdev->irq.vblank_queue);
 	init_waitqueue_head(&rdev->irq.idle_queue);
 
-	/* setup workqueue */
-	rdev->wq = create_workqueue("radeon");
-	if (rdev->wq == NULL)
-		return -ENOMEM;
-
 	/* Set asic functions */
 	r = radeon_asic_init(rdev);
 	if (r)
@@ -806,7 +801,6 @@ void radeon_device_fini(struct radeon_device *rdev)
 	/* evict vram memory */
 	radeon_bo_evict_vram(rdev);
 	radeon_fini(rdev);
-	destroy_workqueue(rdev->wq);
 	vga_switcheroo_unregister_client(rdev->pdev);
 	vga_client_register(rdev->pdev, NULL, NULL, NULL);
 	if (rdev->rio_mem)
diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c
index a108c7e..33b9d21 100644
--- a/drivers/gpu/drm/radeon/radeon_irq_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c
@@ -64,8 +64,6 @@ void radeon_driver_irq_preinstall_kms(struct drm_device *dev)
 	struct radeon_device *rdev = dev->dev_private;
 	unsigned i;
 
-	INIT_WORK(&rdev->hotplug_work, radeon_hotplug_work_func);
-
 	/* Disable *all* interrupts */
 	rdev->irq.sw_int = false;
 	rdev->irq.gui_idle = false;
@@ -110,6 +108,8 @@ int radeon_irq_kms_init(struct radeon_device *rdev)
 {
 	int r = 0;
 
+	INIT_WORK(&rdev->hotplug_work, radeon_hotplug_work_func);
+
 	spin_lock_init(&rdev->irq.sw_lock);
 	r = drm_vblank_init(rdev->ddev, rdev->num_crtc);
 	if (r) {
@@ -148,6 +148,7 @@ void radeon_irq_kms_fini(struct radeon_device *rdev)
 		if (rdev->msi_enabled)
 			pci_disable_msi(rdev->pdev);
 	}
+	flush_work_sync(&rdev->hotplug_work);
 }
 
 void radeon_irq_kms_sw_irq_get(struct radeon_device *rdev)
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
index 8c9b2ef..845f295 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -405,20 +405,13 @@ static ssize_t radeon_set_pm_method(struct device *dev,
 		rdev->pm.dynpm_planned_action = DYNPM_ACTION_DEFAULT;
 		mutex_unlock(&rdev->pm.mutex);
 	} else if (strncmp("profile", buf, strlen("profile")) == 0) {
-		bool flush_wq = false;
-
 		mutex_lock(&rdev->pm.mutex);
-		if (rdev->pm.pm_method == PM_METHOD_DYNPM) {
-			cancel_delayed_work(&rdev->pm.dynpm_idle_work);
-			flush_wq = true;
-		}
 		/* disable dynpm */
 		rdev->pm.dynpm_state = DYNPM_STATE_DISABLED;
 		rdev->pm.dynpm_planned_action = DYNPM_ACTION_NONE;
 		rdev->pm.pm_method = PM_METHOD_PROFILE;
 		mutex_unlock(&rdev->pm.mutex);
-		if (flush_wq)
-			flush_workqueue(rdev->wq);
+		cancel_delayed_work_sync(&rdev->pm.dynpm_idle_work);
 	} else {
 		DRM_ERROR("invalid power method!\n");
 		goto fail;
@@ -520,18 +513,14 @@ static void radeon_hwmon_fini(struct radeon_device *rdev)
 
 void radeon_pm_suspend(struct radeon_device *rdev)
 {
-	bool flush_wq = false;
-
 	mutex_lock(&rdev->pm.mutex);
 	if (rdev->pm.pm_method == PM_METHOD_DYNPM) {
-		cancel_delayed_work(&rdev->pm.dynpm_idle_work);
 		if (rdev->pm.dynpm_state == DYNPM_STATE_ACTIVE)
 			rdev->pm.dynpm_state = DYNPM_STATE_SUSPENDED;
-		flush_wq = true;
 	}
 	mutex_unlock(&rdev->pm.mutex);
-	if (flush_wq)
-		flush_workqueue(rdev->wq);
+
+	cancel_delayed_work_sync(&rdev->pm.dynpm_idle_work);
 }
 
 void radeon_pm_resume(struct radeon_device *rdev)
@@ -546,8 +535,8 @@ void radeon_pm_resume(struct radeon_device *rdev)
 	if (rdev->pm.pm_method == PM_METHOD_DYNPM
 	    && rdev->pm.dynpm_state == DYNPM_STATE_SUSPENDED) {
 		rdev->pm.dynpm_state = DYNPM_STATE_ACTIVE;
-		queue_delayed_work(rdev->wq, &rdev->pm.dynpm_idle_work,
-					msecs_to_jiffies(RADEON_IDLE_LOOP_MS));
+		schedule_delayed_work(&rdev->pm.dynpm_idle_work,
+				      msecs_to_jiffies(RADEON_IDLE_LOOP_MS));
 	}
 	mutex_unlock(&rdev->pm.mutex);
 	radeon_pm_compute_clocks(rdev);
@@ -581,6 +570,9 @@ int radeon_pm_init(struct radeon_device *rdev)
 	ret = radeon_hwmon_init(rdev);
 	if (ret)
 		return ret;
+
+	INIT_DELAYED_WORK(&rdev->pm.dynpm_idle_work, radeon_dynpm_idle_work_handler);
+
 	if (rdev->pm.num_power_states > 1) {
 		/* where's the best place to put these? */
 		ret = device_create_file(rdev->dev, &dev_attr_power_profile);
@@ -594,8 +586,6 @@ int radeon_pm_init(struct radeon_device *rdev)
 		rdev->acpi_nb.notifier_call = radeon_acpi_event;
 		register_acpi_notifier(&rdev->acpi_nb);
 #endif
-		INIT_DELAYED_WORK(&rdev->pm.dynpm_idle_work, radeon_dynpm_idle_work_handler);
-
 		if (radeon_debugfs_pm_init(rdev)) {
 			DRM_ERROR("Failed to register debugfs file for PM!\n");
 		}
@@ -609,25 +599,20 @@ int radeon_pm_init(struct radeon_device *rdev)
 void radeon_pm_fini(struct radeon_device *rdev)
 {
 	if (rdev->pm.num_power_states > 1) {
-		bool flush_wq = false;
-
 		mutex_lock(&rdev->pm.mutex);
 		if (rdev->pm.pm_method == PM_METHOD_PROFILE) {
 			rdev->pm.profile = PM_PROFILE_DEFAULT;
 			radeon_pm_update_profile(rdev);
 			radeon_pm_set_clocks(rdev);
 		} else if (rdev->pm.pm_method == PM_METHOD_DYNPM) {
-			/* cancel work */
-			cancel_delayed_work(&rdev->pm.dynpm_idle_work);
-			flush_wq = true;
 			/* reset default clocks */
 			rdev->pm.dynpm_state = DYNPM_STATE_DISABLED;
 			rdev->pm.dynpm_planned_action = DYNPM_ACTION_DEFAULT;
 			radeon_pm_set_clocks(rdev);
 		}
 		mutex_unlock(&rdev->pm.mutex);
-		if (flush_wq)
-			flush_workqueue(rdev->wq);
+
+		cancel_delayed_work_sync(&rdev->pm.dynpm_idle_work);
 
 		device_remove_file(rdev->dev, &dev_attr_power_profile);
 		device_remove_file(rdev->dev, &dev_attr_power_method);
@@ -686,12 +671,12 @@ void radeon_pm_compute_clocks(struct radeon_device *rdev)
 					radeon_pm_get_dynpm_state(rdev);
 					radeon_pm_set_clocks(rdev);
 
-					queue_delayed_work(rdev->wq, &rdev->pm.dynpm_idle_work,
-							   msecs_to_jiffies(RADEON_IDLE_LOOP_MS));
+					schedule_delayed_work(&rdev->pm.dynpm_idle_work,
+							      msecs_to_jiffies(RADEON_IDLE_LOOP_MS));
 				} else if (rdev->pm.dynpm_state == DYNPM_STATE_PAUSED) {
 					rdev->pm.dynpm_state = DYNPM_STATE_ACTIVE;
-					queue_delayed_work(rdev->wq, &rdev->pm.dynpm_idle_work,
-							   msecs_to_jiffies(RADEON_IDLE_LOOP_MS));
+					schedule_delayed_work(&rdev->pm.dynpm_idle_work,
+							      msecs_to_jiffies(RADEON_IDLE_LOOP_MS));
 					DRM_DEBUG_DRIVER("radeon: dynamic power management activated\n");
 				}
 			} else { /* count == 0 */
@@ -796,8 +781,8 @@ static void radeon_dynpm_idle_work_handler(struct work_struct *work)
 			radeon_pm_set_clocks(rdev);
 		}
 
-		queue_delayed_work(rdev->wq, &rdev->pm.dynpm_idle_work,
-					msecs_to_jiffies(RADEON_IDLE_LOOP_MS));
+		schedule_delayed_work(&rdev->pm.dynpm_idle_work,
+				      msecs_to_jiffies(RADEON_IDLE_LOOP_MS));
 	}
 	mutex_unlock(&rdev->pm.mutex);
 	ttm_bo_unlock_delayed_workqueue(&rdev->mman.bdev, resched);
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c
index f1c6e02..2d707d4 100644
--- a/drivers/gpu/drm/radeon/rs600.c
+++ b/drivers/gpu/drm/radeon/rs600.c
@@ -634,7 +634,7 @@ int rs600_irq_process(struct radeon_device *rdev)
 	/* reset gui idle ack.  the status bit is broken */
 	rdev->irq.gui_idle_acked = false;
 	if (queue_hotplug)
-		queue_work(rdev->wq, &rdev->hotplug_work);
+		schedule_work(&rdev->hotplug_work);
 	if (rdev->msi_enabled) {
 		switch (rdev->family) {
 		case CHIP_RS600:
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 119+ messages in thread

* [PATCH 09/32] drm/radeon: use system_wq instead of dev_priv->wq
@ 2011-01-03 13:49   ` Tejun Heo
  0 siblings, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Tejun Heo, dri-devel

With cmwq, there's no reason for radeon to use a dedicated workqueue.
Drop dev_priv->wq and use system_wq instead.

Because radeon_driver_irq_uninstall_kms() may be called from
unsleepable context, the work items can't be flushed from there.
Instead, init and flush from radeon_irq_kms_init/fini().

While at it, simplify canceling/flushing of rdev->pm.dynpm_idle_work.
Always initialize and sync cancel instead of being unnecessarily smart
about it.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
---
Only compile tested.  Please feel free to take it into the subsystem
tree or simply ack - I'll route it through the wq tree.

Thanks.

 drivers/gpu/drm/radeon/evergreen.c      |    2 +-
 drivers/gpu/drm/radeon/r100.c           |    2 +-
 drivers/gpu/drm/radeon/r600.c           |    2 +-
 drivers/gpu/drm/radeon/radeon.h         |    1 -
 drivers/gpu/drm/radeon/radeon_device.c  |    6 ----
 drivers/gpu/drm/radeon/radeon_irq_kms.c |    5 ++-
 drivers/gpu/drm/radeon/radeon_pm.c      |   47 ++++++++++--------------------
 drivers/gpu/drm/radeon/rs600.c          |    2 +-
 8 files changed, 23 insertions(+), 44 deletions(-)

diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index 7b337c3..6540adb 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -2516,7 +2516,7 @@ restart_ih:
 	if (wptr != rdev->ih.wptr)
 		goto restart_ih;
 	if (queue_hotplug)
-		queue_work(rdev->wq, &rdev->hotplug_work);
+		schedule_work(&rdev->hotplug_work);
 	rdev->ih.rptr = rptr;
 	WREG32(IH_RB_RPTR, rdev->ih.rptr);
 	spin_unlock_irqrestore(&rdev->ih.lock, flags);
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index 8e10aa9..1d15748 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -622,7 +622,7 @@ int r100_irq_process(struct radeon_device *rdev)
 	/* reset gui idle ack.  the status bit is broken */
 	rdev->irq.gui_idle_acked = false;
 	if (queue_hotplug)
-		queue_work(rdev->wq, &rdev->hotplug_work);
+		schedule_work(&rdev->hotplug_work);
 	if (rdev->msi_enabled) {
 		switch (rdev->family) {
 		case CHIP_RS400:
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 9c92db7..f927cd4 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -3419,7 +3419,7 @@ restart_ih:
 	if (wptr != rdev->ih.wptr)
 		goto restart_ih;
 	if (queue_hotplug)
-		queue_work(rdev->wq, &rdev->hotplug_work);
+		schedule_work(&rdev->hotplug_work);
 	rdev->ih.rptr = rptr;
 	WREG32(IH_RB_RPTR, rdev->ih.rptr);
 	spin_unlock_irqrestore(&rdev->ih.lock, flags);
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 3a70957..ba233a8 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -1095,7 +1095,6 @@ struct radeon_device {
 	struct r700_vram_scratch vram_scratch;
 	int msi_enabled; /* msi enabled */
 	struct r600_ih ih; /* r6/700 interrupt ring */
-	struct workqueue_struct *wq;
 	struct work_struct hotplug_work;
 	int num_crtc; /* number of crtcs */
 	struct mutex dc_hw_i2c_mutex; /* display controller hw i2c mutex */
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 501966a..4bc0012 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -704,11 +704,6 @@ int radeon_device_init(struct radeon_device *rdev,
 	init_waitqueue_head(&rdev->irq.vblank_queue);
 	init_waitqueue_head(&rdev->irq.idle_queue);
 
-	/* setup workqueue */
-	rdev->wq = create_workqueue("radeon");
-	if (rdev->wq == NULL)
-		return -ENOMEM;
-
 	/* Set asic functions */
 	r = radeon_asic_init(rdev);
 	if (r)
@@ -806,7 +801,6 @@ void radeon_device_fini(struct radeon_device *rdev)
 	/* evict vram memory */
 	radeon_bo_evict_vram(rdev);
 	radeon_fini(rdev);
-	destroy_workqueue(rdev->wq);
 	vga_switcheroo_unregister_client(rdev->pdev);
 	vga_client_register(rdev->pdev, NULL, NULL, NULL);
 	if (rdev->rio_mem)
diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c
index a108c7e..33b9d21 100644
--- a/drivers/gpu/drm/radeon/radeon_irq_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c
@@ -64,8 +64,6 @@ void radeon_driver_irq_preinstall_kms(struct drm_device *dev)
 	struct radeon_device *rdev = dev->dev_private;
 	unsigned i;
 
-	INIT_WORK(&rdev->hotplug_work, radeon_hotplug_work_func);
-
 	/* Disable *all* interrupts */
 	rdev->irq.sw_int = false;
 	rdev->irq.gui_idle = false;
@@ -110,6 +108,8 @@ int radeon_irq_kms_init(struct radeon_device *rdev)
 {
 	int r = 0;
 
+	INIT_WORK(&rdev->hotplug_work, radeon_hotplug_work_func);
+
 	spin_lock_init(&rdev->irq.sw_lock);
 	r = drm_vblank_init(rdev->ddev, rdev->num_crtc);
 	if (r) {
@@ -148,6 +148,7 @@ void radeon_irq_kms_fini(struct radeon_device *rdev)
 		if (rdev->msi_enabled)
 			pci_disable_msi(rdev->pdev);
 	}
+	flush_work_sync(&rdev->hotplug_work);
 }
 
 void radeon_irq_kms_sw_irq_get(struct radeon_device *rdev)
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
index 8c9b2ef..845f295 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -405,20 +405,13 @@ static ssize_t radeon_set_pm_method(struct device *dev,
 		rdev->pm.dynpm_planned_action = DYNPM_ACTION_DEFAULT;
 		mutex_unlock(&rdev->pm.mutex);
 	} else if (strncmp("profile", buf, strlen("profile")) == 0) {
-		bool flush_wq = false;
-
 		mutex_lock(&rdev->pm.mutex);
-		if (rdev->pm.pm_method == PM_METHOD_DYNPM) {
-			cancel_delayed_work(&rdev->pm.dynpm_idle_work);
-			flush_wq = true;
-		}
 		/* disable dynpm */
 		rdev->pm.dynpm_state = DYNPM_STATE_DISABLED;
 		rdev->pm.dynpm_planned_action = DYNPM_ACTION_NONE;
 		rdev->pm.pm_method = PM_METHOD_PROFILE;
 		mutex_unlock(&rdev->pm.mutex);
-		if (flush_wq)
-			flush_workqueue(rdev->wq);
+		cancel_delayed_work_sync(&rdev->pm.dynpm_idle_work);
 	} else {
 		DRM_ERROR("invalid power method!\n");
 		goto fail;
@@ -520,18 +513,14 @@ static void radeon_hwmon_fini(struct radeon_device *rdev)
 
 void radeon_pm_suspend(struct radeon_device *rdev)
 {
-	bool flush_wq = false;
-
 	mutex_lock(&rdev->pm.mutex);
 	if (rdev->pm.pm_method == PM_METHOD_DYNPM) {
-		cancel_delayed_work(&rdev->pm.dynpm_idle_work);
 		if (rdev->pm.dynpm_state == DYNPM_STATE_ACTIVE)
 			rdev->pm.dynpm_state = DYNPM_STATE_SUSPENDED;
-		flush_wq = true;
 	}
 	mutex_unlock(&rdev->pm.mutex);
-	if (flush_wq)
-		flush_workqueue(rdev->wq);
+
+	cancel_delayed_work_sync(&rdev->pm.dynpm_idle_work);
 }
 
 void radeon_pm_resume(struct radeon_device *rdev)
@@ -546,8 +535,8 @@ void radeon_pm_resume(struct radeon_device *rdev)
 	if (rdev->pm.pm_method == PM_METHOD_DYNPM
 	    && rdev->pm.dynpm_state == DYNPM_STATE_SUSPENDED) {
 		rdev->pm.dynpm_state = DYNPM_STATE_ACTIVE;
-		queue_delayed_work(rdev->wq, &rdev->pm.dynpm_idle_work,
-					msecs_to_jiffies(RADEON_IDLE_LOOP_MS));
+		schedule_delayed_work(&rdev->pm.dynpm_idle_work,
+				      msecs_to_jiffies(RADEON_IDLE_LOOP_MS));
 	}
 	mutex_unlock(&rdev->pm.mutex);
 	radeon_pm_compute_clocks(rdev);
@@ -581,6 +570,9 @@ int radeon_pm_init(struct radeon_device *rdev)
 	ret = radeon_hwmon_init(rdev);
 	if (ret)
 		return ret;
+
+	INIT_DELAYED_WORK(&rdev->pm.dynpm_idle_work, radeon_dynpm_idle_work_handler);
+
 	if (rdev->pm.num_power_states > 1) {
 		/* where's the best place to put these? */
 		ret = device_create_file(rdev->dev, &dev_attr_power_profile);
@@ -594,8 +586,6 @@ int radeon_pm_init(struct radeon_device *rdev)
 		rdev->acpi_nb.notifier_call = radeon_acpi_event;
 		register_acpi_notifier(&rdev->acpi_nb);
 #endif
-		INIT_DELAYED_WORK(&rdev->pm.dynpm_idle_work, radeon_dynpm_idle_work_handler);
-
 		if (radeon_debugfs_pm_init(rdev)) {
 			DRM_ERROR("Failed to register debugfs file for PM!\n");
 		}
@@ -609,25 +599,20 @@ int radeon_pm_init(struct radeon_device *rdev)
 void radeon_pm_fini(struct radeon_device *rdev)
 {
 	if (rdev->pm.num_power_states > 1) {
-		bool flush_wq = false;
-
 		mutex_lock(&rdev->pm.mutex);
 		if (rdev->pm.pm_method == PM_METHOD_PROFILE) {
 			rdev->pm.profile = PM_PROFILE_DEFAULT;
 			radeon_pm_update_profile(rdev);
 			radeon_pm_set_clocks(rdev);
 		} else if (rdev->pm.pm_method == PM_METHOD_DYNPM) {
-			/* cancel work */
-			cancel_delayed_work(&rdev->pm.dynpm_idle_work);
-			flush_wq = true;
 			/* reset default clocks */
 			rdev->pm.dynpm_state = DYNPM_STATE_DISABLED;
 			rdev->pm.dynpm_planned_action = DYNPM_ACTION_DEFAULT;
 			radeon_pm_set_clocks(rdev);
 		}
 		mutex_unlock(&rdev->pm.mutex);
-		if (flush_wq)
-			flush_workqueue(rdev->wq);
+
+		cancel_delayed_work_sync(&rdev->pm.dynpm_idle_work);
 
 		device_remove_file(rdev->dev, &dev_attr_power_profile);
 		device_remove_file(rdev->dev, &dev_attr_power_method);
@@ -686,12 +671,12 @@ void radeon_pm_compute_clocks(struct radeon_device *rdev)
 					radeon_pm_get_dynpm_state(rdev);
 					radeon_pm_set_clocks(rdev);
 
-					queue_delayed_work(rdev->wq, &rdev->pm.dynpm_idle_work,
-							   msecs_to_jiffies(RADEON_IDLE_LOOP_MS));
+					schedule_delayed_work(&rdev->pm.dynpm_idle_work,
+							      msecs_to_jiffies(RADEON_IDLE_LOOP_MS));
 				} else if (rdev->pm.dynpm_state == DYNPM_STATE_PAUSED) {
 					rdev->pm.dynpm_state = DYNPM_STATE_ACTIVE;
-					queue_delayed_work(rdev->wq, &rdev->pm.dynpm_idle_work,
-							   msecs_to_jiffies(RADEON_IDLE_LOOP_MS));
+					schedule_delayed_work(&rdev->pm.dynpm_idle_work,
+							      msecs_to_jiffies(RADEON_IDLE_LOOP_MS));
 					DRM_DEBUG_DRIVER("radeon: dynamic power management activated\n");
 				}
 			} else { /* count == 0 */
@@ -796,8 +781,8 @@ static void radeon_dynpm_idle_work_handler(struct work_struct *work)
 			radeon_pm_set_clocks(rdev);
 		}
 
-		queue_delayed_work(rdev->wq, &rdev->pm.dynpm_idle_work,
-					msecs_to_jiffies(RADEON_IDLE_LOOP_MS));
+		schedule_delayed_work(&rdev->pm.dynpm_idle_work,
+				      msecs_to_jiffies(RADEON_IDLE_LOOP_MS));
 	}
 	mutex_unlock(&rdev->pm.mutex);
 	ttm_bo_unlock_delayed_workqueue(&rdev->mman.bdev, resched);
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c
index f1c6e02..2d707d4 100644
--- a/drivers/gpu/drm/radeon/rs600.c
+++ b/drivers/gpu/drm/radeon/rs600.c
@@ -634,7 +634,7 @@ int rs600_irq_process(struct radeon_device *rdev)
 	/* reset gui idle ack.  the status bit is broken */
 	rdev->irq.gui_idle_acked = false;
 	if (queue_hotplug)
-		queue_work(rdev->wq, &rdev->hotplug_work);
+		schedule_work(&rdev->hotplug_work);
 	if (rdev->msi_enabled) {
 		switch (rdev->family) {
 		case CHIP_RS600:
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 119+ messages in thread

* [PATCH 10/32] input/tps6507x-ts: use system_wq instead of dedicated workqueue
  2011-01-03 13:49 [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
                   ` (8 preceding siblings ...)
  2011-01-03 13:49   ` Tejun Heo
@ 2011-01-03 13:49 ` Tejun Heo
  2011-01-03 14:39   ` Dan Carpenter
  2011-01-03 13:49 ` [PATCH 11/32] v4l/cx18: update workqueue usage Tejun Heo
                   ` (22 subsequent siblings)
  32 siblings, 1 reply; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Tejun Heo, Dmitry Torokhov, linux-input, Dan Carpenter, Todd Fischer

With cmwq, there's no reason to use a separate workqueue.  Drop
tps6507x_ts->wq and use system_wq instead.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org
Cc: Dan Carpenter <error27@gmail.com>
Cc: Todd Fischer <todd.fischer@ridgerun.com>
---
Only compile tested.  Please feel free to take it into the subsystem
tree or simply ack - I'll route it through the wq tree.

Thanks.

 drivers/input/touchscreen/tps6507x-ts.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/input/touchscreen/tps6507x-ts.c b/drivers/input/touchscreen/tps6507x-ts.c
index c8c136c..4303149 100644
--- a/drivers/input/touchscreen/tps6507x-ts.c
+++ b/drivers/input/touchscreen/tps6507x-ts.c
@@ -43,7 +43,6 @@ struct tps6507x_ts {
 	struct input_dev	*input_dev;
 	struct device		*dev;
 	char			phys[32];
-	struct workqueue_struct *wq;
 	struct delayed_work	work;
 	unsigned		polling;	/* polling is active */
 	struct ts_event		tc;
@@ -220,8 +219,8 @@ done:
 	poll = 1;
 
 	if (poll) {
-		schd = queue_delayed_work(tsc->wq, &tsc->work,
-					  msecs_to_jiffies(tsc->poll_period));
+		schd = schedule_delayed_work(&tsc->work,
+					msecs_to_jiffies(tsc->poll_period));
 		if (schd)
 			tsc->polling = 1;
 		else {
@@ -303,7 +302,6 @@ static int tps6507x_ts_probe(struct platform_device *pdev)
 	tsc->input_dev = input_dev;
 
 	INIT_DELAYED_WORK(&tsc->work, tps6507x_ts_handler);
-	tsc->wq = create_workqueue("TPS6507x Touchscreen");
 
 	if (init_data) {
 		tsc->poll_period = init_data->poll_period;
@@ -325,8 +323,8 @@ static int tps6507x_ts_probe(struct platform_device *pdev)
 	if (error)
 		goto err2;
 
-	schd = queue_delayed_work(tsc->wq, &tsc->work,
-				  msecs_to_jiffies(tsc->poll_period));
+	schd = schedule_delayed_work(&tsc->work,
+				     msecs_to_jiffies(tsc->poll_period));
 
 	if (schd)
 		tsc->polling = 1;
@@ -341,7 +339,6 @@ static int tps6507x_ts_probe(struct platform_device *pdev)
 
 err2:
 	cancel_delayed_work_sync(&tsc->work);
-	destroy_workqueue(tsc->wq);
 	input_free_device(input_dev);
 err1:
 	kfree(tsc);
@@ -357,7 +354,6 @@ static int __devexit tps6507x_ts_remove(struct platform_device *pdev)
 	struct input_dev *input_dev = tsc->input_dev;
 
 	cancel_delayed_work_sync(&tsc->work);
-	destroy_workqueue(tsc->wq);
 
 	input_unregister_device(input_dev);
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 119+ messages in thread

* [PATCH 11/32] v4l/cx18: update workqueue usage
  2011-01-03 13:49 [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
                   ` (9 preceding siblings ...)
  2011-01-03 13:49 ` [PATCH 10/32] input/tps6507x-ts: use system_wq instead of dedicated workqueue Tejun Heo
@ 2011-01-03 13:49 ` Tejun Heo
  2011-01-04  0:54   ` Andy Walls
  2011-01-08 17:03   ` Andy Walls
  2011-01-03 13:49 ` [PATCH 12/32] i2o: use alloc_workqueue() instead of create_workqueue() Tejun Heo
                   ` (21 subsequent siblings)
  32 siblings, 2 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Tejun Heo, Andy Walls, linux-media

With cmwq, there's no reason to use separate out_work_queue.  Drop it
and use system_wq instead.  The in_work_queue needs to be ordered so
can't use one of the system wqs; however, as it isn't used to reclaim
memory, allocate the workqueue with alloc_ordered_workqueue() without
WQ_MEM_RECLAIM.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Andy Walls <awalls@md.metrocast.net>
Cc: linux-media@vger.kernel.org
---
Only compile tested.  Please feel free to take it into the subsystem
tree or simply ack - I'll route it through the wq tree.

Thanks.

 drivers/media/video/cx18/cx18-driver.c  |   24 ++----------------------
 drivers/media/video/cx18/cx18-driver.h  |    3 ---
 drivers/media/video/cx18/cx18-streams.h |    3 +--
 3 files changed, 3 insertions(+), 27 deletions(-)

diff --git a/drivers/media/video/cx18/cx18-driver.c b/drivers/media/video/cx18/cx18-driver.c
index df60f27..41c0822 100644
--- a/drivers/media/video/cx18/cx18-driver.c
+++ b/drivers/media/video/cx18/cx18-driver.c
@@ -656,7 +656,7 @@ static int __devinit cx18_create_in_workq(struct cx18 *cx)
 {
 	snprintf(cx->in_workq_name, sizeof(cx->in_workq_name), "%s-in",
 		 cx->v4l2_dev.name);
-	cx->in_work_queue = create_singlethread_workqueue(cx->in_workq_name);
+	cx->in_work_queue = alloc_ordered_workqueue(cx->in_workq_name, 0);
 	if (cx->in_work_queue == NULL) {
 		CX18_ERR("Unable to create incoming mailbox handler thread\n");
 		return -ENOMEM;
@@ -664,18 +664,6 @@ static int __devinit cx18_create_in_workq(struct cx18 *cx)
 	return 0;
 }
 
-static int __devinit cx18_create_out_workq(struct cx18 *cx)
-{
-	snprintf(cx->out_workq_name, sizeof(cx->out_workq_name), "%s-out",
-		 cx->v4l2_dev.name);
-	cx->out_work_queue = create_workqueue(cx->out_workq_name);
-	if (cx->out_work_queue == NULL) {
-		CX18_ERR("Unable to create outgoing mailbox handler threads\n");
-		return -ENOMEM;
-	}
-	return 0;
-}
-
 static void __devinit cx18_init_in_work_orders(struct cx18 *cx)
 {
 	int i;
@@ -702,15 +690,9 @@ static int __devinit cx18_init_struct1(struct cx18 *cx)
 	mutex_init(&cx->epu2apu_mb_lock);
 	mutex_init(&cx->epu2cpu_mb_lock);
 
-	ret = cx18_create_out_workq(cx);
-	if (ret)
-		return ret;
-
 	ret = cx18_create_in_workq(cx);
-	if (ret) {
-		destroy_workqueue(cx->out_work_queue);
+	if (ret)
 		return ret;
-	}
 
 	cx18_init_in_work_orders(cx);
 
@@ -1094,7 +1076,6 @@ free_mem:
 	release_mem_region(cx->base_addr, CX18_MEM_SIZE);
 free_workqueues:
 	destroy_workqueue(cx->in_work_queue);
-	destroy_workqueue(cx->out_work_queue);
 err:
 	if (retval == 0)
 		retval = -ENODEV;
@@ -1244,7 +1225,6 @@ static void cx18_remove(struct pci_dev *pci_dev)
 	cx18_halt_firmware(cx);
 
 	destroy_workqueue(cx->in_work_queue);
-	destroy_workqueue(cx->out_work_queue);
 
 	cx18_streams_cleanup(cx, 1);
 
diff --git a/drivers/media/video/cx18/cx18-driver.h b/drivers/media/video/cx18/cx18-driver.h
index 77be58c..f7f71d1 100644
--- a/drivers/media/video/cx18/cx18-driver.h
+++ b/drivers/media/video/cx18/cx18-driver.h
@@ -614,9 +614,6 @@ struct cx18 {
 	struct cx18_in_work_order in_work_order[CX18_MAX_IN_WORK_ORDERS];
 	char epu_debug_str[256]; /* CX18_EPU_DEBUG is rare: use shared space */
 
-	struct workqueue_struct *out_work_queue;
-	char out_workq_name[12]; /* "cx18-NN-out" */
-
 	/* i2c */
 	struct i2c_adapter i2c_adap[2];
 	struct i2c_algo_bit_data i2c_algo[2];
diff --git a/drivers/media/video/cx18/cx18-streams.h b/drivers/media/video/cx18/cx18-streams.h
index 77412be..5837ffb 100644
--- a/drivers/media/video/cx18/cx18-streams.h
+++ b/drivers/media/video/cx18/cx18-streams.h
@@ -41,8 +41,7 @@ static inline bool cx18_stream_enabled(struct cx18_stream *s)
 /* Related to submission of mdls to firmware */
 static inline void cx18_stream_load_fw_queue(struct cx18_stream *s)
 {
-	struct cx18 *cx = s->cx;
-	queue_work(cx->out_work_queue, &s->out_work_order);
+	schedule_work(&s->out_work_order);
 }
 
 static inline void cx18_stream_put_mdl_fw(struct cx18_stream *s,
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 119+ messages in thread

* [PATCH 12/32] i2o: use alloc_workqueue() instead of create_workqueue()
  2011-01-03 13:49 [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
                   ` (10 preceding siblings ...)
  2011-01-03 13:49 ` [PATCH 11/32] v4l/cx18: update workqueue usage Tejun Heo
@ 2011-01-03 13:49 ` Tejun Heo
  2011-01-03 13:49 ` [PATCH 13/32] misc/iwmc3200top: use system_wq instead of dedicated workqueues Tejun Heo
                   ` (20 subsequent siblings)
  32 siblings, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Tejun Heo, Markus Lidel

This is an identity conversion.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Markus Lidel <Markus.Lidel@shadowconnect.com>
---
Please feel free to take it into the subsystem tree or simply ack -
I'll route it through the wq tree.

Thanks.

 drivers/message/i2o/driver.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/message/i2o/driver.c b/drivers/message/i2o/driver.c
index a0421ef..8a5b2d8 100644
--- a/drivers/message/i2o/driver.c
+++ b/drivers/message/i2o/driver.c
@@ -84,7 +84,8 @@ int i2o_driver_register(struct i2o_driver *drv)
 	osm_debug("Register driver %s\n", drv->name);
 
 	if (drv->event) {
-		drv->event_queue = create_workqueue(drv->name);
+		drv->event_queue = alloc_workqueue(drv->name,
+						   WQ_MEM_RECLAIM, 1);
 		if (!drv->event_queue) {
 			osm_err("Could not initialize event queue for driver "
 				"%s\n", drv->name);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 119+ messages in thread

* [PATCH 13/32] misc/iwmc3200top: use system_wq instead of dedicated workqueues
  2011-01-03 13:49 [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
                   ` (11 preceding siblings ...)
  2011-01-03 13:49 ` [PATCH 12/32] i2o: use alloc_workqueue() instead of create_workqueue() Tejun Heo
@ 2011-01-03 13:49 ` Tejun Heo
  2011-01-03 13:49 ` [PATCH 14/32] wireless/ipw2x00: " Tejun Heo
                   ` (19 subsequent siblings)
  32 siblings, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Tejun Heo, Tomas Winkler

With cmwq, there's no reason to use separate workqueues in
iwmc3200top.  Drop them and use system_wq instead.  The used work
items are sync flushed before driver detach.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Tomas Winkler <tomas.winkler@intel.com>
---
Only compile tested.  Please feel free to take it into the subsystem
tree or simply ack - I'll route it through the wq tree.

Thanks.

 drivers/misc/iwmc3200top/iwmc3200top.h |    4 +---
 drivers/misc/iwmc3200top/main.c        |   14 +++++---------
 2 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/misc/iwmc3200top/iwmc3200top.h b/drivers/misc/iwmc3200top/iwmc3200top.h
index 740ff07..620973e 100644
--- a/drivers/misc/iwmc3200top/iwmc3200top.h
+++ b/drivers/misc/iwmc3200top/iwmc3200top.h
@@ -183,9 +183,7 @@ struct iwmct_priv {
 	u32 barker;
 	struct iwmct_dbg dbg;
 
-	/* drivers work queue */
-	struct workqueue_struct *wq;
-	struct workqueue_struct *bus_rescan_wq;
+	/* drivers work items */
 	struct work_struct bus_rescan_worker;
 	struct work_struct isr_worker;
 
diff --git a/drivers/misc/iwmc3200top/main.c b/drivers/misc/iwmc3200top/main.c
index c73cef2..727af07 100644
--- a/drivers/misc/iwmc3200top/main.c
+++ b/drivers/misc/iwmc3200top/main.c
@@ -89,7 +89,7 @@ static void op_top_message(struct iwmct_priv *priv, struct top_msg *msg)
 	switch (msg->hdr.opcode) {
 	case OP_OPR_ALIVE:
 		LOG_INFO(priv, FW_MSG, "Got ALIVE from device, wake rescan\n");
-		queue_work(priv->bus_rescan_wq, &priv->bus_rescan_worker);
+		schedule_work(&priv->bus_rescan_worker);
 		break;
 	default:
 		LOG_INFO(priv, FW_MSG, "Received msg opcode 0x%X\n",
@@ -360,7 +360,7 @@ static void iwmct_irq(struct sdio_func *func)
 	/* clear the function's interrupt request bit (write 1 to clear) */
 	sdio_writeb(func, 1, IWMC_SDIO_INTR_CLEAR_ADDR, &ret);
 
-	queue_work(priv->wq, &priv->isr_worker);
+	schedule_work(&priv->isr_worker);
 
 	LOG_TRACE(priv, IRQ, "exit iwmct_irq\n");
 
@@ -506,10 +506,6 @@ static int iwmct_probe(struct sdio_func *func,
 	priv->func = func;
 	sdio_set_drvdata(func, priv);
 
-
-	/* create drivers work queue */
-	priv->wq = create_workqueue(DRV_NAME "_wq");
-	priv->bus_rescan_wq = create_workqueue(DRV_NAME "_rescan_wq");
 	INIT_WORK(&priv->bus_rescan_worker, iwmct_rescan_worker);
 	INIT_WORK(&priv->isr_worker, iwmct_irq_read_worker);
 
@@ -604,9 +600,9 @@ static void iwmct_remove(struct sdio_func *func)
 	sdio_release_irq(func);
 	sdio_release_host(func);
 
-	/* Safely destroy osc workqueue */
-	destroy_workqueue(priv->bus_rescan_wq);
-	destroy_workqueue(priv->wq);
+	/* Make sure works are finished */
+	flush_work_sync(&priv->bus_rescan_worker);
+	flush_work_sync(&priv->isr_worker);
 
 	sdio_claim_host(func);
 	sdio_disable_func(func);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 119+ messages in thread

* [PATCH 14/32] wireless/ipw2x00: use system_wq instead of dedicated workqueues
  2011-01-03 13:49 [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
                   ` (12 preceding siblings ...)
  2011-01-03 13:49 ` [PATCH 13/32] misc/iwmc3200top: use system_wq instead of dedicated workqueues Tejun Heo
@ 2011-01-03 13:49 ` Tejun Heo
  2011-01-06 20:51   ` John W. Linville
  2011-01-03 13:49 ` [PATCH 15/32] wireless/libertas[_tf]: " Tejun Heo
                   ` (18 subsequent siblings)
  32 siblings, 1 reply; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Tejun Heo, John W. Linville, linux-wireless

With cmwq, there's no reason to use separate workqueues in ipw2x00
drivers.  Drop them and use system_wq instead.  All used work items
are sync canceled on driver detach.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: "John W. Linville" <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org
---
Only compile tested.  Please feel free to take it into the subsystem
tree or simply ack - I'll route it through the wq tree.

Thanks.

 drivers/net/wireless/ipw2x00/ipw2100.c |   70 +++++-------
 drivers/net/wireless/ipw2x00/ipw2100.h |    1 -
 drivers/net/wireless/ipw2x00/ipw2200.c |  196 ++++++++++++++------------------
 drivers/net/wireless/ipw2x00/ipw2200.h |    2 -
 4 files changed, 118 insertions(+), 151 deletions(-)

diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c
index 61915f3..471a52a 100644
--- a/drivers/net/wireless/ipw2x00/ipw2100.c
+++ b/drivers/net/wireless/ipw2x00/ipw2100.c
@@ -706,11 +706,10 @@ static void schedule_reset(struct ipw2100_priv *priv)
 		netif_stop_queue(priv->net_dev);
 		priv->status |= STATUS_RESET_PENDING;
 		if (priv->reset_backoff)
-			queue_delayed_work(priv->workqueue, &priv->reset_work,
-					   priv->reset_backoff * HZ);
+			schedule_delayed_work(&priv->reset_work,
+					      priv->reset_backoff * HZ);
 		else
-			queue_delayed_work(priv->workqueue, &priv->reset_work,
-					   0);
+			schedule_delayed_work(&priv->reset_work, 0);
 
 		if (priv->reset_backoff < MAX_RESET_BACKOFF)
 			priv->reset_backoff++;
@@ -1474,7 +1473,7 @@ static int ipw2100_enable_adapter(struct ipw2100_priv *priv)
 
 	if (priv->stop_hang_check) {
 		priv->stop_hang_check = 0;
-		queue_delayed_work(priv->workqueue, &priv->hang_check, HZ / 2);
+		schedule_delayed_work(&priv->hang_check, HZ / 2);
 	}
 
       fail_up:
@@ -1808,8 +1807,8 @@ static int ipw2100_up(struct ipw2100_priv *priv, int deferred)
 
 		if (priv->stop_rf_kill) {
 			priv->stop_rf_kill = 0;
-			queue_delayed_work(priv->workqueue, &priv->rf_kill,
-					   round_jiffies_relative(HZ));
+			schedule_delayed_work(&priv->rf_kill,
+					      round_jiffies_relative(HZ));
 		}
 
 		deferred = 1;
@@ -2086,7 +2085,7 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status)
 	priv->status |= STATUS_ASSOCIATING;
 	priv->connect_start = get_seconds();
 
-	queue_delayed_work(priv->workqueue, &priv->wx_event_work, HZ / 10);
+	schedule_delayed_work(&priv->wx_event_work, HZ / 10);
 }
 
 static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid,
@@ -2166,9 +2165,9 @@ static void isr_indicate_association_lost(struct ipw2100_priv *priv, u32 status)
 		return;
 
 	if (priv->status & STATUS_SECURITY_UPDATED)
-		queue_delayed_work(priv->workqueue, &priv->security_work, 0);
+		schedule_delayed_work(&priv->security_work, 0);
 
-	queue_delayed_work(priv->workqueue, &priv->wx_event_work, 0);
+	schedule_delayed_work(&priv->wx_event_work, 0);
 }
 
 static void isr_indicate_rf_kill(struct ipw2100_priv *priv, u32 status)
@@ -2183,8 +2182,7 @@ static void isr_indicate_rf_kill(struct ipw2100_priv *priv, u32 status)
 	/* Make sure the RF Kill check timer is running */
 	priv->stop_rf_kill = 0;
 	cancel_delayed_work(&priv->rf_kill);
-	queue_delayed_work(priv->workqueue, &priv->rf_kill,
-			   round_jiffies_relative(HZ));
+	schedule_delayed_work(&priv->rf_kill, round_jiffies_relative(HZ));
 }
 
 static void send_scan_event(void *data)
@@ -2219,13 +2217,12 @@ static void isr_scan_complete(struct ipw2100_priv *priv, u32 status)
 	/* Only userspace-requested scan completion events go out immediately */
 	if (!priv->user_requested_scan) {
 		if (!delayed_work_pending(&priv->scan_event_later))
-			queue_delayed_work(priv->workqueue,
-					&priv->scan_event_later,
-					round_jiffies_relative(msecs_to_jiffies(4000)));
+			schedule_delayed_work(&priv->scan_event_later,
+					      round_jiffies_relative(msecs_to_jiffies(4000)));
 	} else {
 		priv->user_requested_scan = 0;
 		cancel_delayed_work(&priv->scan_event_later);
-		queue_work(priv->workqueue, &priv->scan_event_now);
+		schedule_work(&priv->scan_event_now);
 	}
 }
 
@@ -4329,8 +4326,8 @@ static int ipw_radio_kill_sw(struct ipw2100_priv *priv, int disable_radio)
 			/* Make sure the RF_KILL check timer is running */
 			priv->stop_rf_kill = 0;
 			cancel_delayed_work(&priv->rf_kill);
-			queue_delayed_work(priv->workqueue, &priv->rf_kill,
-					   round_jiffies_relative(HZ));
+			schedule_delayed_work(&priv->rf_kill,
+					      round_jiffies_relative(HZ));
 		} else
 			schedule_reset(priv);
 	}
@@ -4461,20 +4458,17 @@ static void bd_queue_initialize(struct ipw2100_priv *priv,
 	IPW_DEBUG_INFO("exit\n");
 }
 
-static void ipw2100_kill_workqueue(struct ipw2100_priv *priv)
+static void ipw2100_kill_works(struct ipw2100_priv *priv)
 {
-	if (priv->workqueue) {
-		priv->stop_rf_kill = 1;
-		priv->stop_hang_check = 1;
-		cancel_delayed_work(&priv->reset_work);
-		cancel_delayed_work(&priv->security_work);
-		cancel_delayed_work(&priv->wx_event_work);
-		cancel_delayed_work(&priv->hang_check);
-		cancel_delayed_work(&priv->rf_kill);
-		cancel_delayed_work(&priv->scan_event_later);
-		destroy_workqueue(priv->workqueue);
-		priv->workqueue = NULL;
-	}
+	priv->stop_rf_kill = 1;
+	priv->stop_hang_check = 1;
+	cancel_delayed_work_sync(&priv->reset_work);
+	cancel_delayed_work_sync(&priv->security_work);
+	cancel_delayed_work_sync(&priv->wx_event_work);
+	cancel_delayed_work_sync(&priv->hang_check);
+	cancel_delayed_work_sync(&priv->rf_kill);
+	cancel_work_sync(&priv->scan_event_now);
+	cancel_delayed_work_sync(&priv->scan_event_later);
 }
 
 static int ipw2100_tx_allocate(struct ipw2100_priv *priv)
@@ -6046,7 +6040,7 @@ static void ipw2100_hang_check(struct work_struct *work)
 	priv->last_rtc = rtc;
 
 	if (!priv->stop_hang_check)
-		queue_delayed_work(priv->workqueue, &priv->hang_check, HZ / 2);
+		schedule_delayed_work(&priv->hang_check, HZ / 2);
 
 	spin_unlock_irqrestore(&priv->low_lock, flags);
 }
@@ -6062,8 +6056,8 @@ static void ipw2100_rf_kill(struct work_struct *work)
 	if (rf_kill_active(priv)) {
 		IPW_DEBUG_RF_KILL("RF Kill active, rescheduling GPIO check\n");
 		if (!priv->stop_rf_kill)
-			queue_delayed_work(priv->workqueue, &priv->rf_kill,
-					   round_jiffies_relative(HZ));
+			schedule_delayed_work(&priv->rf_kill,
+					      round_jiffies_relative(HZ));
 		goto exit_unlock;
 	}
 
@@ -6209,8 +6203,6 @@ static struct net_device *ipw2100_alloc_device(struct pci_dev *pci_dev,
 	INIT_LIST_HEAD(&priv->fw_pend_list);
 	INIT_STAT(&priv->fw_pend_stat);
 
-	priv->workqueue = create_workqueue(DRV_NAME);
-
 	INIT_DELAYED_WORK(&priv->reset_work, ipw2100_reset_adapter);
 	INIT_DELAYED_WORK(&priv->security_work, ipw2100_security_work);
 	INIT_DELAYED_WORK(&priv->wx_event_work, ipw2100_wx_event_work);
@@ -6410,7 +6402,7 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev,
 		if (dev->irq)
 			free_irq(dev->irq, priv);
 
-		ipw2100_kill_workqueue(priv);
+		ipw2100_kill_works(priv);
 
 		/* These are safe to call even if they weren't allocated */
 		ipw2100_queues_free(priv);
@@ -6460,9 +6452,7 @@ static void __devexit ipw2100_pci_remove_one(struct pci_dev *pci_dev)
 		 * first, then close() will crash. */
 		unregister_netdev(dev);
 
-		/* ipw2100_down will ensure that there is no more pending work
-		 * in the workqueue's, so we can safely remove them now. */
-		ipw2100_kill_workqueue(priv);
+		ipw2100_kill_works(priv);
 
 		ipw2100_queues_free(priv);
 
diff --git a/drivers/net/wireless/ipw2x00/ipw2100.h b/drivers/net/wireless/ipw2x00/ipw2100.h
index 838002b..99cba96 100644
--- a/drivers/net/wireless/ipw2x00/ipw2100.h
+++ b/drivers/net/wireless/ipw2x00/ipw2100.h
@@ -580,7 +580,6 @@ struct ipw2100_priv {
 
 	struct tasklet_struct irq_tasklet;
 
-	struct workqueue_struct *workqueue;
 	struct delayed_work reset_work;
 	struct delayed_work security_work;
 	struct delayed_work wx_event_work;
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c
index 8d6ed5f..7319395 100644
--- a/drivers/net/wireless/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/ipw2x00/ipw2200.c
@@ -894,9 +894,8 @@ static void ipw_led_link_on(struct ipw_priv *priv)
 
 		/* If we aren't associated, schedule turning the LED off */
 		if (!(priv->status & STATUS_ASSOCIATED))
-			queue_delayed_work(priv->workqueue,
-					   &priv->led_link_off,
-					   LD_TIME_LINK_ON);
+			schedule_delayed_work(&priv->led_link_off,
+					      LD_TIME_LINK_ON);
 	}
 
 	spin_unlock_irqrestore(&priv->lock, flags);
@@ -939,8 +938,8 @@ static void ipw_led_link_off(struct ipw_priv *priv)
 		 * turning the LED on (blink while unassociated) */
 		if (!(priv->status & STATUS_RF_KILL_MASK) &&
 		    !(priv->status & STATUS_ASSOCIATED))
-			queue_delayed_work(priv->workqueue, &priv->led_link_on,
-					   LD_TIME_LINK_OFF);
+			schedule_delayed_work(&priv->led_link_on,
+					      LD_TIME_LINK_OFF);
 
 	}
 
@@ -980,13 +979,11 @@ static void __ipw_led_activity_on(struct ipw_priv *priv)
 		priv->status |= STATUS_LED_ACT_ON;
 
 		cancel_delayed_work(&priv->led_act_off);
-		queue_delayed_work(priv->workqueue, &priv->led_act_off,
-				   LD_TIME_ACT_ON);
+		schedule_delayed_work(&priv->led_act_off, LD_TIME_ACT_ON);
 	} else {
 		/* Reschedule LED off for full time period */
 		cancel_delayed_work(&priv->led_act_off);
-		queue_delayed_work(priv->workqueue, &priv->led_act_off,
-				   LD_TIME_ACT_ON);
+		schedule_delayed_work(&priv->led_act_off, LD_TIME_ACT_ON);
 	}
 }
 
@@ -1795,13 +1792,11 @@ static int ipw_radio_kill_sw(struct ipw_priv *priv, int disable_radio)
 	if (disable_radio) {
 		priv->status |= STATUS_RF_KILL_SW;
 
-		if (priv->workqueue) {
-			cancel_delayed_work(&priv->request_scan);
-			cancel_delayed_work(&priv->request_direct_scan);
-			cancel_delayed_work(&priv->request_passive_scan);
-			cancel_delayed_work(&priv->scan_event);
-		}
-		queue_work(priv->workqueue, &priv->down);
+		cancel_delayed_work(&priv->request_scan);
+		cancel_delayed_work(&priv->request_direct_scan);
+		cancel_delayed_work(&priv->request_passive_scan);
+		cancel_delayed_work(&priv->scan_event);
+		schedule_work(&priv->down);
 	} else {
 		priv->status &= ~STATUS_RF_KILL_SW;
 		if (rf_kill_active(priv)) {
@@ -1809,10 +1804,10 @@ static int ipw_radio_kill_sw(struct ipw_priv *priv, int disable_radio)
 					  "disabled by HW switch\n");
 			/* Make sure the RF_KILL check timer is running */
 			cancel_delayed_work(&priv->rf_kill);
-			queue_delayed_work(priv->workqueue, &priv->rf_kill,
-					   round_jiffies_relative(2 * HZ));
+			schedule_delayed_work(&priv->rf_kill,
+					      round_jiffies_relative(2 * HZ));
 		} else
-			queue_work(priv->workqueue, &priv->up);
+			schedule_work(&priv->up);
 	}
 
 	return 1;
@@ -2056,7 +2051,7 @@ static void ipw_irq_tasklet(struct ipw_priv *priv)
 		cancel_delayed_work(&priv->request_passive_scan);
 		cancel_delayed_work(&priv->scan_event);
 		schedule_work(&priv->link_down);
-		queue_delayed_work(priv->workqueue, &priv->rf_kill, 2 * HZ);
+		schedule_delayed_work(&priv->rf_kill, 2 * HZ);
 		handled |= IPW_INTA_BIT_RF_KILL_DONE;
 	}
 
@@ -2096,7 +2091,7 @@ static void ipw_irq_tasklet(struct ipw_priv *priv)
 		priv->status &= ~STATUS_HCMD_ACTIVE;
 		wake_up_interruptible(&priv->wait_command_queue);
 
-		queue_work(priv->workqueue, &priv->adapter_restart);
+		schedule_work(&priv->adapter_restart);
 		handled |= IPW_INTA_BIT_FATAL_ERROR;
 	}
 
@@ -2316,11 +2311,6 @@ static int ipw_send_adapter_address(struct ipw_priv *priv, u8 * mac)
 	return ipw_send_cmd_pdu(priv, IPW_CMD_ADAPTER_ADDRESS, ETH_ALEN, mac);
 }
 
-/*
- * NOTE: This must be executed from our workqueue as it results in udelay
- * being called which may corrupt the keyboard if executed on default
- * workqueue
- */
 static void ipw_adapter_restart(void *adapter)
 {
 	struct ipw_priv *priv = adapter;
@@ -2361,13 +2351,13 @@ static void ipw_scan_check(void *data)
 		IPW_DEBUG_SCAN("Scan completion watchdog resetting "
 			       "adapter after (%dms).\n",
 			       jiffies_to_msecs(IPW_SCAN_CHECK_WATCHDOG));
-		queue_work(priv->workqueue, &priv->adapter_restart);
+		schedule_work(&priv->adapter_restart);
 	} else if (priv->status & STATUS_SCANNING) {
 		IPW_DEBUG_SCAN("Scan completion watchdog aborting scan "
 			       "after (%dms).\n",
 			       jiffies_to_msecs(IPW_SCAN_CHECK_WATCHDOG));
 		ipw_abort_scan(priv);
-		queue_delayed_work(priv->workqueue, &priv->scan_check, HZ);
+		schedule_delayed_work(&priv->scan_check, HZ);
 	}
 }
 
@@ -3936,7 +3926,7 @@ static void ipw_send_disassociate(struct ipw_priv *priv, int quiet)
 
 	if (priv->status & STATUS_ASSOCIATING) {
 		IPW_DEBUG_ASSOC("Disassociating while associating.\n");
-		queue_work(priv->workqueue, &priv->disassociate);
+		schedule_work(&priv->disassociate);
 		return;
 	}
 
@@ -4353,8 +4343,7 @@ static void ipw_gather_stats(struct ipw_priv *priv)
 
 	priv->quality = quality;
 
-	queue_delayed_work(priv->workqueue, &priv->gather_stats,
-			   IPW_STATS_INTERVAL);
+	schedule_delayed_work(&priv->gather_stats, IPW_STATS_INTERVAL);
 }
 
 static void ipw_bg_gather_stats(struct work_struct *work)
@@ -4389,10 +4378,10 @@ static void ipw_handle_missed_beacon(struct ipw_priv *priv,
 			IPW_DEBUG(IPW_DL_INFO | IPW_DL_NOTIF |
 				  IPW_DL_STATE,
 				  "Aborting scan with missed beacon.\n");
-			queue_work(priv->workqueue, &priv->abort_scan);
+			schedule_work(&priv->abort_scan);
 		}
 
-		queue_work(priv->workqueue, &priv->disassociate);
+		schedule_work(&priv->disassociate);
 		return;
 	}
 
@@ -4418,8 +4407,7 @@ static void ipw_handle_missed_beacon(struct ipw_priv *priv,
 		if (!(priv->status & STATUS_ROAMING)) {
 			priv->status |= STATUS_ROAMING;
 			if (!(priv->status & STATUS_SCANNING))
-				queue_delayed_work(priv->workqueue,
-						   &priv->request_scan, 0);
+				schedule_delayed_work(&priv->request_scan, 0);
 		}
 		return;
 	}
@@ -4432,7 +4420,7 @@ static void ipw_handle_missed_beacon(struct ipw_priv *priv,
 		 * channels..) */
 		IPW_DEBUG(IPW_DL_INFO | IPW_DL_NOTIF | IPW_DL_STATE,
 			  "Aborting scan with missed beacon.\n");
-		queue_work(priv->workqueue, &priv->abort_scan);
+		schedule_work(&priv->abort_scan);
 	}
 
 	IPW_DEBUG_NOTIF("Missed beacon: %d\n", missed_count);
@@ -4455,8 +4443,8 @@ static void handle_scan_event(struct ipw_priv *priv)
 	/* Only userspace-requested scan completion events go out immediately */
 	if (!priv->user_requested_scan) {
 		if (!delayed_work_pending(&priv->scan_event))
-			queue_delayed_work(priv->workqueue, &priv->scan_event,
-					 round_jiffies_relative(msecs_to_jiffies(4000)));
+			schedule_delayed_work(&priv->scan_event,
+					      round_jiffies_relative(msecs_to_jiffies(4000)));
 	} else {
 		union iwreq_data wrqu;
 
@@ -4509,20 +4497,17 @@ static void ipw_rx_notification(struct ipw_priv *priv,
 
 						IPW_DEBUG_ASSOC
 						    ("queueing adhoc check\n");
-						queue_delayed_work(priv->
-								   workqueue,
-								   &priv->
-								   adhoc_check,
-								   le16_to_cpu(priv->
-								   assoc_request.
-								   beacon_interval));
+						schedule_delayed_work(
+							&priv->adhoc_check,
+							le16_to_cpu(priv->
+							assoc_request.
+							beacon_interval));
 						break;
 					}
 
 					priv->status &= ~STATUS_ASSOCIATING;
 					priv->status |= STATUS_ASSOCIATED;
-					queue_work(priv->workqueue,
-						   &priv->system_config);
+					schedule_work(&priv->system_config);
 
 #ifdef CONFIG_IPW2200_QOS
 #define IPW_GET_PACKET_STYPE(x) WLAN_FC_GET_STYPE( \
@@ -4785,43 +4770,37 @@ static void ipw_rx_notification(struct ipw_priv *priv,
 #ifdef CONFIG_IPW2200_MONITOR
 			if (priv->ieee->iw_mode == IW_MODE_MONITOR) {
 				priv->status |= STATUS_SCAN_FORCED;
-				queue_delayed_work(priv->workqueue,
-						   &priv->request_scan, 0);
+				schedule_delayed_work(&priv->request_scan, 0);
 				break;
 			}
 			priv->status &= ~STATUS_SCAN_FORCED;
 #endif				/* CONFIG_IPW2200_MONITOR */
 
 			/* Do queued direct scans first */
-			if (priv->status & STATUS_DIRECT_SCAN_PENDING) {
-				queue_delayed_work(priv->workqueue,
-						   &priv->request_direct_scan, 0);
-			}
+			if (priv->status & STATUS_DIRECT_SCAN_PENDING)
+				schedule_delayed_work(&priv->request_direct_scan, 0);
 
 			if (!(priv->status & (STATUS_ASSOCIATED |
 					      STATUS_ASSOCIATING |
 					      STATUS_ROAMING |
 					      STATUS_DISASSOCIATING)))
-				queue_work(priv->workqueue, &priv->associate);
+				schedule_work(&priv->associate);
 			else if (priv->status & STATUS_ROAMING) {
 				if (x->status == SCAN_COMPLETED_STATUS_COMPLETE)
 					/* If a scan completed and we are in roam mode, then
 					 * the scan that completed was the one requested as a
 					 * result of entering roam... so, schedule the
 					 * roam work */
-					queue_work(priv->workqueue,
-						   &priv->roam);
+					schedule_work(&priv->roam);
 				else
 					/* Don't schedule if we aborted the scan */
 					priv->status &= ~STATUS_ROAMING;
 			} else if (priv->status & STATUS_SCAN_PENDING)
-				queue_delayed_work(priv->workqueue,
-						   &priv->request_scan, 0);
+				schedule_delayed_work(&priv->request_scan, 0);
 			else if (priv->config & CFG_BACKGROUND_SCAN
 				 && priv->status & STATUS_ASSOCIATED)
-				queue_delayed_work(priv->workqueue,
-						   &priv->request_scan,
-						   round_jiffies_relative(HZ));
+				schedule_delayed_work(&priv->request_scan,
+						      round_jiffies_relative(HZ));
 
 			/* Send an empty event to user space.
 			 * We don't send the received data on the event because
@@ -5185,7 +5164,7 @@ static void ipw_rx_queue_restock(struct ipw_priv *priv)
 	/* If the pre-allocated buffer pool is dropping low, schedule to
 	 * refill it */
 	if (rxq->free_count <= RX_LOW_WATERMARK)
-		queue_work(priv->workqueue, &priv->rx_replenish);
+		schedule_work(&priv->rx_replenish);
 
 	/* If we've added more space for the firmware to place data, tell it */
 	if (write != rxq->write)
@@ -6126,8 +6105,8 @@ static void ipw_adhoc_check(void *data)
 		return;
 	}
 
-	queue_delayed_work(priv->workqueue, &priv->adhoc_check,
-			   le16_to_cpu(priv->assoc_request.beacon_interval));
+	schedule_delayed_work(&priv->adhoc_check,
+			      le16_to_cpu(priv->assoc_request.beacon_interval));
 }
 
 static void ipw_bg_adhoc_check(struct work_struct *work)
@@ -6516,8 +6495,7 @@ send_request:
 	} else
 		priv->status &= ~STATUS_SCAN_PENDING;
 
-	queue_delayed_work(priv->workqueue, &priv->scan_check,
-			   IPW_SCAN_CHECK_WATCHDOG);
+	schedule_delayed_work(&priv->scan_check, IPW_SCAN_CHECK_WATCHDOG);
 done:
 	mutex_unlock(&priv->mutex);
 	return err;
@@ -6987,8 +6965,7 @@ static int ipw_qos_handle_probe_response(struct ipw_priv *priv,
 				    !memcmp(network->ssid,
 					    priv->assoc_network->ssid,
 					    network->ssid_len)) {
-					queue_work(priv->workqueue,
-						   &priv->merge_networks);
+					schedule_work(&priv->merge_networks);
 				}
 	}
 
@@ -7656,7 +7633,7 @@ static int ipw_associate(void *data)
 	if (priv->status & STATUS_DISASSOCIATING) {
 		IPW_DEBUG_ASSOC("Not attempting association (in "
 				"disassociating)\n ");
-		queue_work(priv->workqueue, &priv->associate);
+		schedule_work(&priv->associate);
 		return 0;
 	}
 
@@ -7724,12 +7701,10 @@ static int ipw_associate(void *data)
 
 		if (!(priv->status & STATUS_SCANNING)) {
 			if (!(priv->config & CFG_SPEED_SCAN))
-				queue_delayed_work(priv->workqueue,
-						   &priv->request_scan,
-						   SCAN_INTERVAL);
+				schedule_delayed_work(&priv->request_scan,
+						      SCAN_INTERVAL);
 			else
-				queue_delayed_work(priv->workqueue,
-						   &priv->request_scan, 0);
+				schedule_delayed_work(&priv->request_scan, 0);
 		}
 
 		return 0;
@@ -8892,7 +8867,7 @@ static int ipw_wx_set_mode(struct net_device *dev,
 
 	priv->ieee->iw_mode = wrqu->mode;
 
-	queue_work(priv->workqueue, &priv->adapter_restart);
+	schedule_work(&priv->adapter_restart);
 	mutex_unlock(&priv->mutex);
 	return err;
 }
@@ -9591,7 +9566,7 @@ static int ipw_wx_set_scan(struct net_device *dev,
 
 	IPW_DEBUG_WX("Start scan\n");
 
-	queue_delayed_work(priv->workqueue, work, 0);
+	schedule_delayed_work(work, 0);
 
 	return 0;
 }
@@ -9930,7 +9905,7 @@ static int ipw_wx_set_monitor(struct net_device *dev,
 #else
 			priv->net_dev->type = ARPHRD_IEEE80211;
 #endif
-			queue_work(priv->workqueue, &priv->adapter_restart);
+			schedule_work(&priv->adapter_restart);
 		}
 
 		ipw_set_channel(priv, parms[1]);
@@ -9940,7 +9915,7 @@ static int ipw_wx_set_monitor(struct net_device *dev,
 			return 0;
 		}
 		priv->net_dev->type = ARPHRD_ETHER;
-		queue_work(priv->workqueue, &priv->adapter_restart);
+		schedule_work(&priv->adapter_restart);
 	}
 	mutex_unlock(&priv->mutex);
 	return 0;
@@ -9954,7 +9929,7 @@ static int ipw_wx_reset(struct net_device *dev,
 {
 	struct ipw_priv *priv = libipw_priv(dev);
 	IPW_DEBUG_WX("RESET\n");
-	queue_work(priv->workqueue, &priv->adapter_restart);
+	schedule_work(&priv->adapter_restart);
 	return 0;
 }
 
@@ -10544,7 +10519,7 @@ static int ipw_net_set_mac_address(struct net_device *dev, void *p)
 	memcpy(priv->mac_addr, addr->sa_data, ETH_ALEN);
 	printk(KERN_INFO "%s: Setting MAC to %pM\n",
 	       priv->net_dev->name, priv->mac_addr);
-	queue_work(priv->workqueue, &priv->adapter_restart);
+	schedule_work(&priv->adapter_restart);
 	mutex_unlock(&priv->mutex);
 	return 0;
 }
@@ -10677,9 +10652,7 @@ static void ipw_rf_kill(void *adapter)
 
 	if (rf_kill_active(priv)) {
 		IPW_DEBUG_RF_KILL("RF Kill active, rescheduling GPIO check\n");
-		if (priv->workqueue)
-			queue_delayed_work(priv->workqueue,
-					   &priv->rf_kill, 2 * HZ);
+		schedule_delayed_work(&priv->rf_kill, 2 * HZ);
 		goto exit_unlock;
 	}
 
@@ -10690,7 +10663,7 @@ static void ipw_rf_kill(void *adapter)
 				  "device\n");
 
 		/* we can not do an adapter restart while inside an irq lock */
-		queue_work(priv->workqueue, &priv->adapter_restart);
+		schedule_work(&priv->adapter_restart);
 	} else
 		IPW_DEBUG_RF_KILL("HW RF Kill deactivated.  SW RF Kill still "
 				  "enabled\n");
@@ -10728,7 +10701,7 @@ static void ipw_link_up(struct ipw_priv *priv)
 	notify_wx_assoc_event(priv);
 
 	if (priv->config & CFG_BACKGROUND_SCAN)
-		queue_delayed_work(priv->workqueue, &priv->request_scan, HZ);
+		schedule_delayed_work(&priv->request_scan, HZ);
 }
 
 static void ipw_bg_link_up(struct work_struct *work)
@@ -10757,7 +10730,7 @@ static void ipw_link_down(struct ipw_priv *priv)
 
 	if (!(priv->status & STATUS_EXIT_PENDING)) {
 		/* Queue up another scan... */
-		queue_delayed_work(priv->workqueue, &priv->request_scan, 0);
+		schedule_delayed_work(&priv->request_scan, 0);
 	} else
 		cancel_delayed_work(&priv->scan_event);
 }
@@ -10775,7 +10748,6 @@ static int __devinit ipw_setup_deferred_work(struct ipw_priv *priv)
 {
 	int ret = 0;
 
-	priv->workqueue = create_workqueue(DRV_NAME);
 	init_waitqueue_head(&priv->wait_command_queue);
 	init_waitqueue_head(&priv->wait_state);
 
@@ -11332,8 +11304,7 @@ static int ipw_up(struct ipw_priv *priv)
 			IPW_WARNING("Radio Frequency Kill Switch is On:\n"
 				    "Kill switch must be turned off for "
 				    "wireless networking to work.\n");
-			queue_delayed_work(priv->workqueue, &priv->rf_kill,
-					   2 * HZ);
+			schedule_delayed_work(&priv->rf_kill, 2 * HZ);
 			return 0;
 		}
 
@@ -11343,8 +11314,7 @@ static int ipw_up(struct ipw_priv *priv)
 
 			/* If configure to try and auto-associate, kick
 			 * off a scan. */
-			queue_delayed_work(priv->workqueue,
-					   &priv->request_scan, 0);
+			schedule_delayed_work(&priv->request_scan, 0);
 
 			return 0;
 		}
@@ -11810,7 +11780,7 @@ static int __devinit ipw_pci_probe(struct pci_dev *pdev,
 	err = request_irq(pdev->irq, ipw_isr, IRQF_SHARED, DRV_NAME, priv);
 	if (err) {
 		IPW_ERROR("Error allocating IRQ %d\n", pdev->irq);
-		goto out_destroy_workqueue;
+		goto out_iounmap;
 	}
 
 	SET_NETDEV_DEV(net_dev, &pdev->dev);
@@ -11878,9 +11848,6 @@ static int __devinit ipw_pci_probe(struct pci_dev *pdev,
 	sysfs_remove_group(&pdev->dev.kobj, &ipw_attribute_group);
       out_release_irq:
 	free_irq(pdev->irq, priv);
-      out_destroy_workqueue:
-	destroy_workqueue(priv->workqueue);
-	priv->workqueue = NULL;
       out_iounmap:
 	iounmap(priv->hw_base);
       out_pci_release_regions:
@@ -11923,18 +11890,31 @@ static void __devexit ipw_pci_remove(struct pci_dev *pdev)
 		kfree(priv->cmdlog);
 		priv->cmdlog = NULL;
 	}
-	/* ipw_down will ensure that there is no more pending work
-	 * in the workqueue's, so we can safely remove them now. */
-	cancel_delayed_work(&priv->adhoc_check);
-	cancel_delayed_work(&priv->gather_stats);
-	cancel_delayed_work(&priv->request_scan);
-	cancel_delayed_work(&priv->request_direct_scan);
-	cancel_delayed_work(&priv->request_passive_scan);
-	cancel_delayed_work(&priv->scan_event);
-	cancel_delayed_work(&priv->rf_kill);
-	cancel_delayed_work(&priv->scan_check);
-	destroy_workqueue(priv->workqueue);
-	priv->workqueue = NULL;
+
+	/* make sure all works are inactive */
+	cancel_delayed_work_sync(&priv->adhoc_check);
+	cancel_work_sync(&priv->associate);
+	cancel_work_sync(&priv->disassociate);
+	cancel_work_sync(&priv->system_config);
+	cancel_work_sync(&priv->rx_replenish);
+	cancel_work_sync(&priv->adapter_restart);
+	cancel_delayed_work_sync(&priv->rf_kill);
+	cancel_work_sync(&priv->up);
+	cancel_work_sync(&priv->down);
+	cancel_delayed_work_sync(&priv->request_scan);
+	cancel_delayed_work_sync(&priv->request_direct_scan);
+	cancel_delayed_work_sync(&priv->request_passive_scan);
+	cancel_delayed_work_sync(&priv->scan_event);
+	cancel_delayed_work_sync(&priv->gather_stats);
+	cancel_work_sync(&priv->abort_scan);
+	cancel_work_sync(&priv->roam);
+	cancel_delayed_work_sync(&priv->scan_check);
+	cancel_work_sync(&priv->link_up);
+	cancel_work_sync(&priv->link_down);
+	cancel_delayed_work_sync(&priv->led_link_on);
+	cancel_delayed_work_sync(&priv->led_link_off);
+	cancel_delayed_work_sync(&priv->led_act_off);
+	cancel_work_sync(&priv->merge_networks);
 
 	/* Free MAC hash list for ADHOC */
 	for (i = 0; i < IPW_IBSS_MAC_HASH_SIZE; i++) {
@@ -12022,7 +12002,7 @@ static int ipw_pci_resume(struct pci_dev *pdev)
 	priv->suspend_time = get_seconds() - priv->suspend_at;
 
 	/* Bring the device back up */
-	queue_work(priv->workqueue, &priv->up);
+	schedule_work(&priv->up);
 
 	return 0;
 }
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.h b/drivers/net/wireless/ipw2x00/ipw2200.h
index d7d049c..0441445 100644
--- a/drivers/net/wireless/ipw2x00/ipw2200.h
+++ b/drivers/net/wireless/ipw2x00/ipw2200.h
@@ -1299,8 +1299,6 @@ struct ipw_priv {
 	u8 direct_scan_ssid[IW_ESSID_MAX_SIZE];
 	u8 direct_scan_ssid_len;
 
-	struct workqueue_struct *workqueue;
-
 	struct delayed_work adhoc_check;
 	struct work_struct associate;
 	struct work_struct disassociate;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 119+ messages in thread

* [PATCH 15/32] wireless/libertas[_tf]: use system_wq instead of dedicated workqueues
  2011-01-03 13:49 [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
                   ` (13 preceding siblings ...)
  2011-01-03 13:49 ` [PATCH 14/32] wireless/ipw2x00: " Tejun Heo
@ 2011-01-03 13:49 ` Tejun Heo
  2011-02-01 10:52   ` Tejun Heo
  2011-01-03 13:49 ` [PATCH 16/32] scsi/be2iscsi,qla2xxx: convert to alloc_workqueue() Tejun Heo
                   ` (17 subsequent siblings)
  32 siblings, 1 reply; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Tejun Heo, Dan Williams, libertas-dev

With cmwq, there's no reason to use separate workqueues in
libertas[_tf] drivers.  Drop them and use system_wq instead.  All used
work items are sync flushed/canceled on driver detach.

Cc: Dan Williams <dcbw@redhat.com>
Cc: libertas-dev@lists.infradead.org
---
Only compile tested.  Please feel free to take it into the subsystem
tree or simply ack - I'll route it through the wq tree.

Thanks.

 drivers/net/wireless/libertas/if_sdio.c        |   10 +++-------
 drivers/net/wireless/libertas_tf/cmd.c         |    6 +++---
 drivers/net/wireless/libertas_tf/libertas_tf.h |    2 --
 drivers/net/wireless/libertas_tf/main.c        |   16 ++++------------
 4 files changed, 10 insertions(+), 24 deletions(-)

diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c
index b4de0ca..257f664 100644
--- a/drivers/net/wireless/libertas/if_sdio.c
+++ b/drivers/net/wireless/libertas/if_sdio.c
@@ -129,7 +129,6 @@ struct if_sdio_card {
 	spinlock_t		lock;
 	struct if_sdio_packet	*packets;
 
-	struct workqueue_struct	*workqueue;
 	struct work_struct	packet_worker;
 
 	u8			rx_unit;
@@ -828,7 +827,7 @@ static int if_sdio_host_to_card(struct lbs_private *priv,
 
 	spin_unlock_irqrestore(&card->lock, flags);
 
-	queue_work(card->workqueue, &card->packet_worker);
+	schedule_work(&card->packet_worker);
 
 	ret = 0;
 
@@ -986,7 +985,6 @@ static int if_sdio_probe(struct sdio_func *func,
 	}
 
 	spin_lock_init(&card->lock);
-	card->workqueue = create_workqueue("libertas_sdio");
 	INIT_WORK(&card->packet_worker, if_sdio_host_to_card_worker);
 
 	/* Check if we support this card */
@@ -1114,7 +1112,7 @@ out:
 	return ret;
 
 err_activate_card:
-	flush_workqueue(card->workqueue);
+	flush_work_sync(&card->packet_worker);
 	lbs_remove_card(priv);
 reclaim:
 	sdio_claim_host(func);
@@ -1125,7 +1123,6 @@ disable:
 release:
 	sdio_release_host(func);
 free:
-	destroy_workqueue(card->workqueue);
 	while (card->packets) {
 		packet = card->packets;
 		card->packets = card->packets->next;
@@ -1171,8 +1168,7 @@ static void if_sdio_remove(struct sdio_func *func)
 	lbs_stop_card(card->priv);
 	lbs_remove_card(card->priv);
 
-	flush_workqueue(card->workqueue);
-	destroy_workqueue(card->workqueue);
+	flush_work_sync(&card->packet_worker);
 
 	sdio_claim_host(func);
 	sdio_release_irq(func);
diff --git a/drivers/net/wireless/libertas_tf/cmd.c b/drivers/net/wireless/libertas_tf/cmd.c
index 8945afd..c429e02 100644
--- a/drivers/net/wireless/libertas_tf/cmd.c
+++ b/drivers/net/wireless/libertas_tf/cmd.c
@@ -623,7 +623,7 @@ static struct cmd_ctrl_node *__lbtf_cmd_async(struct lbtf_private *priv,
 		lbtf_deb_host("PREP_CMD: cmdnode is NULL\n");
 
 		/* Wake up main thread to execute next command */
-		queue_work(lbtf_wq, &priv->cmd_work);
+		schedule_work(&priv->cmd_work);
 		cmdnode = ERR_PTR(-ENOBUFS);
 		goto done;
 	}
@@ -645,7 +645,7 @@ static struct cmd_ctrl_node *__lbtf_cmd_async(struct lbtf_private *priv,
 
 	cmdnode->cmdwaitqwoken = 0;
 	lbtf_queue_cmd(priv, cmdnode);
-	queue_work(lbtf_wq, &priv->cmd_work);
+	schedule_work(&priv->cmd_work);
 
  done:
 	lbtf_deb_leave_args(LBTF_DEB_HOST, "ret %p", cmdnode);
@@ -707,7 +707,7 @@ EXPORT_SYMBOL_GPL(__lbtf_cmd);
 void lbtf_cmd_response_rx(struct lbtf_private *priv)
 {
 	priv->cmd_response_rxed = 1;
-	queue_work(lbtf_wq, &priv->cmd_work);
+	schedule_work(&priv->cmd_work);
 }
 EXPORT_SYMBOL_GPL(lbtf_cmd_response_rx);
 
diff --git a/drivers/net/wireless/libertas_tf/libertas_tf.h b/drivers/net/wireless/libertas_tf/libertas_tf.h
index ad77b92..6b0f932 100644
--- a/drivers/net/wireless/libertas_tf/libertas_tf.h
+++ b/drivers/net/wireless/libertas_tf/libertas_tf.h
@@ -156,8 +156,6 @@ enum mv_ms_type {
 	MVMS_EVENT
 };
 
-extern struct workqueue_struct *lbtf_wq;
-
 struct lbtf_private;
 
 struct lbtf_offset_value {
diff --git a/drivers/net/wireless/libertas_tf/main.c b/drivers/net/wireless/libertas_tf/main.c
index 9278b3c..622d029 100644
--- a/drivers/net/wireless/libertas_tf/main.c
+++ b/drivers/net/wireless/libertas_tf/main.c
@@ -31,8 +31,6 @@ static const char lbtf_driver_version[] = "THINFIRM-USB8388-" DRIVER_RELEASE_VER
 #endif
 	"";
 
-struct workqueue_struct *lbtf_wq;
-
 static const struct ieee80211_channel lbtf_channels[] = {
 	{ .center_freq = 2412, .hw_value = 1 },
 	{ .center_freq = 2417, .hw_value = 2 },
@@ -188,7 +186,7 @@ static void command_timer_fn(unsigned long data)
 		le16_to_cpu(priv->cur_cmd->cmdbuf->command));
 
 	priv->cmd_timed_out = 1;
-	queue_work(lbtf_wq, &priv->cmd_work);
+	schedule_work(&priv->cmd_work);
 out:
 	spin_unlock_irqrestore(&priv->driver_lock, flags);
 	lbtf_deb_leave(LBTF_DEB_CMD);
@@ -230,7 +228,7 @@ static int lbtf_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
 	struct lbtf_private *priv = hw->priv;
 
 	priv->skb_to_tx = skb;
-	queue_work(lbtf_wq, &priv->tx_work);
+	schedule_work(&priv->tx_work);
 	/*
 	 * queue will be restarted when we receive transmission feedback if
 	 * there are no buffered multicast frames to send
@@ -706,7 +704,7 @@ void lbtf_send_tx_feedback(struct lbtf_private *priv, u8 retrycnt, u8 fail)
 	if (!priv->skb_to_tx && skb_queue_empty(&priv->bc_ps_buf))
 		ieee80211_wake_queues(priv->hw);
 	else
-		queue_work(lbtf_wq, &priv->tx_work);
+		schedule_work(&priv->tx_work);
 }
 EXPORT_SYMBOL_GPL(lbtf_send_tx_feedback);
 
@@ -726,7 +724,7 @@ void lbtf_bcn_sent(struct lbtf_private *priv)
 		}
 		if (tx_buff_bc) {
 			ieee80211_stop_queues(priv->hw);
-			queue_work(lbtf_wq, &priv->tx_work);
+			schedule_work(&priv->tx_work);
 		}
 	}
 
@@ -742,11 +740,6 @@ EXPORT_SYMBOL_GPL(lbtf_bcn_sent);
 static int __init lbtf_init_module(void)
 {
 	lbtf_deb_enter(LBTF_DEB_MAIN);
-	lbtf_wq = create_workqueue("libertastf");
-	if (lbtf_wq == NULL) {
-		printk(KERN_ERR "libertastf: couldn't create workqueue\n");
-		return -ENOMEM;
-	}
 	lbtf_deb_leave(LBTF_DEB_MAIN);
 	return 0;
 }
@@ -754,7 +747,6 @@ static int __init lbtf_init_module(void)
 static void __exit lbtf_exit_module(void)
 {
 	lbtf_deb_enter(LBTF_DEB_MAIN);
-	destroy_workqueue(lbtf_wq);
 	lbtf_deb_leave(LBTF_DEB_MAIN);
 }
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 119+ messages in thread

* [PATCH 16/32] scsi/be2iscsi,qla2xxx: convert to alloc_workqueue()
  2011-01-03 13:49 [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
                   ` (14 preceding siblings ...)
  2011-01-03 13:49 ` [PATCH 15/32] wireless/libertas[_tf]: " Tejun Heo
@ 2011-01-03 13:49 ` Tejun Heo
  2011-02-01 23:45   ` Mike Christie
  2011-01-03 13:49 ` [PATCH 17/32] scsi/ibmvstgt: use system_wq instead of vtgtd workqueue Tejun Heo
                   ` (16 subsequent siblings)
  32 siblings, 1 reply; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Tejun Heo, Jayamohan Kallickal, Andrew Vasquez,
	James E.J. Bottomley, linux-scsi

Switch to new workqueue interface alloc_workqueue().  These are
identity conversions.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Jayamohan Kallickal <jayamohank@serverengines.com>
Cc: Andrew Vasquez <andrew.vasquez@qlogic.com>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: linux-scsi@vger.kernel.org
---
Please feel free to take it into the subsystem tree or simply ack -
I'll route it through the wq tree.

Thanks.

 drivers/scsi/be2iscsi/be_main.c |    2 +-
 drivers/scsi/qla2xxx/qla_os.c   |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 75a85aa..4339196 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -4276,7 +4276,7 @@ static int __devinit beiscsi_dev_probe(struct pci_dev *pcidev,
 
 	snprintf(phba->wq_name, sizeof(phba->wq_name), "beiscsi_q_irq%u",
 		 phba->shost->host_no);
-	phba->wq = create_workqueue(phba->wq_name);
+	phba->wq = alloc_workqueue(phba->wq_name, WQ_MEM_RECLAIM, 1);
 	if (!phba->wq) {
 		shost_printk(KERN_ERR, phba->shost, "beiscsi_dev_probe-"
 				"Failed to allocate work queue\n");
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 2c0876c..2cd0a77 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -356,7 +356,7 @@ static int qla25xx_setup_mode(struct scsi_qla_host *vha)
 				"Can't create request queue\n");
 			goto fail;
 		}
-		ha->wq = create_workqueue("qla2xxx_wq");
+		ha->wq = alloc_workqueue("qla2xxx_wq", WQ_MEM_RECLAIM, 1);
 		vha->req = ha->req_q_map[req];
 		options |= BIT_1;
 		for (ques = 1; ques < ha->max_rsp_queues; ques++) {
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 119+ messages in thread

* [PATCH 17/32] scsi/ibmvstgt: use system_wq instead of vtgtd workqueue
  2011-01-03 13:49 [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
                   ` (15 preceding siblings ...)
  2011-01-03 13:49 ` [PATCH 16/32] scsi/be2iscsi,qla2xxx: convert to alloc_workqueue() Tejun Heo
@ 2011-01-03 13:49 ` Tejun Heo
  2011-01-03 17:45   ` Bart Van Assche
  2011-01-24 16:09   ` Bart Van Assche
  2011-01-03 13:49 ` [PATCH 18/32] scsi/scsi_tgt_lib: scsi_tgtd isn't used in memory reclaim path Tejun Heo
                   ` (15 subsequent siblings)
  32 siblings, 2 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Tejun Heo, FUJITA Tomonori, James E.J. Bottomley, linux-scsi

The target driver is not in the memory reclaim path and doesn't need a
dedicated workqueue.  Drop vtgtd and use system_wq instead.  The used
work item is sync flushed on removal.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: linux-scsi@vger.kernel.org
---
Only compile tested.  Please feel free to take it into the subsystem
tree or simply ack - I'll route it through the wq tree.

Thanks.

 drivers/scsi/ibmvscsi/ibmvstgt.c |   15 ++++-----------
 1 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/scsi/ibmvscsi/ibmvstgt.c b/drivers/scsi/ibmvscsi/ibmvstgt.c
index 2256bab..47fc632 100644
--- a/drivers/scsi/ibmvscsi/ibmvstgt.c
+++ b/drivers/scsi/ibmvscsi/ibmvstgt.c
@@ -74,7 +74,6 @@ struct vio_port {
 	struct srp_rport *rport;
 };
 
-static struct workqueue_struct *vtgtd;
 static struct scsi_transport_template *ibmvstgt_transport_template;
 
 /*
@@ -546,7 +545,7 @@ static irqreturn_t ibmvstgt_interrupt(int dummy, void *data)
 	struct vio_port *vport = target_to_port(target);
 
 	vio_disable_interrupts(vport->dma_dev);
-	queue_work(vtgtd, &vport->crq_work);
+	schedule_work(&vport->crq_work);
 
 	return IRQ_HANDLED;
 }
@@ -900,6 +899,7 @@ static int ibmvstgt_remove(struct vio_dev *dev)
 	crq_queue_destroy(target);
 	srp_remove_host(shost);
 	scsi_remove_host(shost);
+	flush_work_sync(&vport->crq_work);
 	scsi_tgt_free_queue(shost);
 	srp_target_free(target);
 	kfree(vport);
@@ -967,21 +967,15 @@ static int __init ibmvstgt_init(void)
 	if (!ibmvstgt_transport_template)
 		return err;
 
-	vtgtd = create_workqueue("ibmvtgtd");
-	if (!vtgtd)
-		goto release_transport;
-
 	err = get_system_info();
 	if (err)
-		goto destroy_wq;
+		goto release_transport;
 
 	err = vio_register_driver(&ibmvstgt_driver);
 	if (err)
-		goto destroy_wq;
+		goto release_transport;
 
 	return 0;
-destroy_wq:
-	destroy_workqueue(vtgtd);
 release_transport:
 	srp_release_transport(ibmvstgt_transport_template);
 	return err;
@@ -991,7 +985,6 @@ static void __exit ibmvstgt_exit(void)
 {
 	printk("Unregister IBM virtual SCSI driver\n");
 
-	destroy_workqueue(vtgtd);
 	vio_unregister_driver(&ibmvstgt_driver);
 	srp_release_transport(ibmvstgt_transport_template);
 }
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 119+ messages in thread

* [PATCH 18/32] scsi/scsi_tgt_lib: scsi_tgtd isn't used in memory reclaim path
  2011-01-03 13:49 [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
                   ` (16 preceding siblings ...)
  2011-01-03 13:49 ` [PATCH 17/32] scsi/ibmvstgt: use system_wq instead of vtgtd workqueue Tejun Heo
@ 2011-01-03 13:49 ` Tejun Heo
  2011-01-03 13:49 ` [PATCH 19/32] usb/ueagle-atm: use system_wq instead of dedicated workqueues Tejun Heo
                   ` (14 subsequent siblings)
  32 siblings, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Tejun Heo, FUJITA Tomonori, James E.J. Bottomley, linux-scsi

Workqueue scsi_tgtd isn't used during memory reclaim.  Convert to
alloc_workqueue() without WQ_MEM_RECLAIM.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: FUJITA Tomonori <tomof@acm.org>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: linux-scsi@vger.kernel.org
---
Only compile tested.  Please feel free to take it into the subsystem
tree or simply ack - I'll route it through the wq tree.

Thanks.

 drivers/scsi/scsi_tgt_lib.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/scsi_tgt_lib.c b/drivers/scsi/scsi_tgt_lib.c
index c399be9..f672820 100644
--- a/drivers/scsi/scsi_tgt_lib.c
+++ b/drivers/scsi/scsi_tgt_lib.c
@@ -629,7 +629,7 @@ static int __init scsi_tgt_init(void)
 	if (!scsi_tgt_cmd_cache)
 		return -ENOMEM;
 
-	scsi_tgtd = create_workqueue("scsi_tgtd");
+	scsi_tgtd = alloc_workqueue("scsi_tgtd", 0, 1);
 	if (!scsi_tgtd) {
 		err = -ENOMEM;
 		goto free_kmemcache;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 119+ messages in thread

* [PATCH 19/32] usb/ueagle-atm: use system_wq instead of dedicated workqueues
  2011-01-03 13:49 [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
                   ` (17 preceding siblings ...)
  2011-01-03 13:49 ` [PATCH 18/32] scsi/scsi_tgt_lib: scsi_tgtd isn't used in memory reclaim path Tejun Heo
@ 2011-01-03 13:49 ` Tejun Heo
  2011-01-03 13:49 ` [PATCH 20/32] video/msm_fb: " Tejun Heo
                   ` (13 subsequent siblings)
  32 siblings, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Tejun Heo, Stanislaw Gruszka, linux-usb

With cmwq, there's no reason to use separate workqueues.  Drop
uea_softc->work_q and use system_wq instead.  The used work item is
sync flushed on driver detach.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Stanislaw Gruszka <stf_xl@wp.pl>
Cc: linux-usb@vger.kernel.org
---
Only compile tested.  Please feel free to take it into the subsystem
tree or simply ack - I'll route it through the wq tree.

Thanks.

 drivers/usb/atm/ueagle-atm.c |   19 +++++--------------
 1 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c
index 44447f5..55c1d3b 100644
--- a/drivers/usb/atm/ueagle-atm.c
+++ b/drivers/usb/atm/ueagle-atm.c
@@ -168,7 +168,6 @@ struct uea_softc {
 	union cmv_dsc cmv_dsc;
 
 	struct work_struct task;
-	struct workqueue_struct *work_q;
 	u16 pageno;
 	u16 ovl;
 
@@ -1879,7 +1878,7 @@ static int uea_start_reset(struct uea_softc *sc)
 	/* start loading DSP */
 	sc->pageno = 0;
 	sc->ovl = 0;
-	queue_work(sc->work_q, &sc->task);
+	schedule_work(&sc->task);
 
 	/* wait for modem ready CMV */
 	ret = wait_cmv_ack(sc);
@@ -2091,14 +2090,14 @@ static void uea_schedule_load_page_e1(struct uea_softc *sc,
 {
 	sc->pageno = intr->e1_bSwapPageNo;
 	sc->ovl = intr->e1_bOvl >> 4 | intr->e1_bOvl << 4;
-	queue_work(sc->work_q, &sc->task);
+	schedule_work(&sc->task);
 }
 
 static void uea_schedule_load_page_e4(struct uea_softc *sc,
 						struct intr_pkt *intr)
 {
 	sc->pageno = intr->e4_bSwapPageNo;
-	queue_work(sc->work_q, &sc->task);
+	schedule_work(&sc->task);
 }
 
 /*
@@ -2170,13 +2169,6 @@ static int uea_boot(struct uea_softc *sc)
 
 	init_waitqueue_head(&sc->sync_q);
 
-	sc->work_q = create_workqueue("ueagle-dsp");
-	if (!sc->work_q) {
-		uea_err(INS_TO_USBDEV(sc), "cannot allocate workqueue\n");
-		uea_leaves(INS_TO_USBDEV(sc));
-		return -ENOMEM;
-	}
-
 	if (UEA_CHIP_VERSION(sc) == ADI930)
 		load_XILINX_firmware(sc);
 
@@ -2222,7 +2214,6 @@ err1:
 	sc->urb_int = NULL;
 	kfree(intr);
 err0:
-	destroy_workqueue(sc->work_q);
 	uea_leaves(INS_TO_USBDEV(sc));
 	return -ENOMEM;
 }
@@ -2243,8 +2234,8 @@ static void uea_stop(struct uea_softc *sc)
 	kfree(sc->urb_int->transfer_buffer);
 	usb_free_urb(sc->urb_int);
 
-	/* stop any pending boot process, when no one can schedule work */
-	destroy_workqueue(sc->work_q);
+	/* flush the work item, when no one can schedule it */
+	flush_work_sync(&sc->task);
 
 	if (sc->dsp_firm)
 		release_firmware(sc->dsp_firm);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 119+ messages in thread

* [PATCH 20/32] video/msm_fb: use system_wq instead of dedicated workqueues
  2011-01-03 13:49 [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
                   ` (18 preceding siblings ...)
  2011-01-03 13:49 ` [PATCH 19/32] usb/ueagle-atm: use system_wq instead of dedicated workqueues Tejun Heo
@ 2011-01-03 13:49 ` Tejun Heo
       [not found]   ` <1294062595-30097-21-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
  2011-01-25 23:21   ` David Brown
  2011-01-03 13:49 ` [PATCH 21/32] fs/aio: aio_wq isn't used in memory reclaim path Tejun Heo
                   ` (12 subsequent siblings)
  32 siblings, 2 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Tejun Heo, Stanislaw Gruszka, linux-usb

With cmwq, there's no reason to use separate workqueues.  Drop
msmfb_info->resume_workqueue and use system_wq instead.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Stanislaw Gruszka <stf_xl@wp.pl>
Cc: linux-usb@vger.kernel.org
---
Only compile tested.  Please feel free to take it into the subsystem
tree or simply ack - I'll route it through the wq tree.

Thanks.

 drivers/video/msm/msm_fb.c |   11 +----------
 1 files changed, 1 insertions(+), 10 deletions(-)

diff --git a/drivers/video/msm/msm_fb.c b/drivers/video/msm/msm_fb.c
index debe593..5436aeb 100644
--- a/drivers/video/msm/msm_fb.c
+++ b/drivers/video/msm/msm_fb.c
@@ -81,7 +81,6 @@ struct msmfb_info {
 	spinlock_t update_lock;
 	struct mutex panel_init_lock;
 	wait_queue_head_t frame_wq;
-	struct workqueue_struct *resume_workqueue;
 	struct work_struct resume_work;
 	struct msmfb_callback dma_callback;
 	struct msmfb_callback vsync_callback;
@@ -111,7 +110,7 @@ static void msmfb_handle_dma_interrupt(struct msmfb_callback *callback)
 	if (msmfb->sleeping == UPDATING &&
 	    msmfb->frame_done == msmfb->update_frame) {
 		DLOG(SUSPEND_RESUME, "full update completed\n");
-		queue_work(msmfb->resume_workqueue, &msmfb->resume_work);
+		schedule_work(&msmfb->resume_work);
 	}
 	spin_unlock_irqrestore(&msmfb->update_lock, irq_flags);
 	wake_up(&msmfb->frame_wq);
@@ -559,12 +558,6 @@ static int msmfb_probe(struct platform_device *pdev)
 	spin_lock_init(&msmfb->update_lock);
 	mutex_init(&msmfb->panel_init_lock);
 	init_waitqueue_head(&msmfb->frame_wq);
-	msmfb->resume_workqueue = create_workqueue("panel_on");
-	if (msmfb->resume_workqueue == NULL) {
-		printk(KERN_ERR "failed to create panel_on workqueue\n");
-		ret = -ENOMEM;
-		goto error_create_workqueue;
-	}
 	INIT_WORK(&msmfb->resume_work, power_on_panel);
 	msmfb->black = kzalloc(msmfb->fb->var.bits_per_pixel*msmfb->xres,
 			       GFP_KERNEL);
@@ -589,8 +582,6 @@ static int msmfb_probe(struct platform_device *pdev)
 	return 0;
 
 error_register_framebuffer:
-	destroy_workqueue(msmfb->resume_workqueue);
-error_create_workqueue:
 	iounmap(fb->screen_base);
 error_setup_fbmem:
 	framebuffer_release(msmfb->fb);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 119+ messages in thread

* [PATCH 21/32] fs/aio: aio_wq isn't used in memory reclaim path
  2011-01-03 13:49 [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
                   ` (19 preceding siblings ...)
  2011-01-03 13:49 ` [PATCH 20/32] video/msm_fb: " Tejun Heo
@ 2011-01-03 13:49 ` Tejun Heo
  2011-01-04 15:56   ` Jeff Moyer
  2011-01-26 11:21   ` [PATCH UPDATED " Tejun Heo
  2011-01-03 13:49 ` [PATCH 22/32] ceph: fsc->*_wq's aren't " Tejun Heo
                   ` (11 subsequent siblings)
  32 siblings, 2 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Tejun Heo, Benjamin LaHaise, linux-aio

aio_wq isn't used during memory reclaim.  Convert to alloc_workqueue()
without WQ_MEM_RECLAIM.  It's possible to use system_wq but given that
the number of work items is determined from userland and the work item
may block, enforcing strict concurrency limit would be a good idea.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Benjamin LaHaise <bcrl@kvack.org>
Cc: linux-aio@kvack.org
---
Please feel free to take it into the subsystem tree or simply ack -
I'll route it through the wq tree.

Thanks.

 fs/aio.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/aio.c b/fs/aio.c
index 8c8f6c5..dc3fcbb 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -85,7 +85,7 @@ static int __init aio_setup(void)
 	kiocb_cachep = KMEM_CACHE(kiocb, SLAB_HWCACHE_ALIGN|SLAB_PANIC);
 	kioctx_cachep = KMEM_CACHE(kioctx,SLAB_HWCACHE_ALIGN|SLAB_PANIC);
 
-	aio_wq = create_workqueue("aio");
+	aio_wq = alloc_workqueue("aio", 0, 1);	/* used to limit concurrency */
 	abe_pool = mempool_create_kmalloc_pool(1, sizeof(struct aio_batch_entry));
 	BUG_ON(!abe_pool);
 
@@ -569,7 +569,7 @@ static int __aio_put_req(struct kioctx *ctx, struct kiocb *req)
 		spin_lock(&fput_lock);
 		list_add(&req->ki_list, &fput_head);
 		spin_unlock(&fput_lock);
-		queue_work(aio_wq, &fput_work);
+		schedule_work(&fput_work);
 	} else {
 		req->ki_filp = NULL;
 		really_put_req(ctx, req);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 119+ messages in thread

* [PATCH 22/32] ceph: fsc->*_wq's aren't used in memory reclaim path
  2011-01-03 13:49 [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
                   ` (20 preceding siblings ...)
  2011-01-03 13:49 ` [PATCH 21/32] fs/aio: aio_wq isn't used in memory reclaim path Tejun Heo
@ 2011-01-03 13:49 ` Tejun Heo
  2011-01-03 17:58   ` Sage Weil
  2011-01-03 13:49 ` [PATCH 23/32] net/ceph: make ceph_msgr_wq non-reentrant Tejun Heo
                   ` (10 subsequent siblings)
  32 siblings, 1 reply; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Tejun Heo, Sage Weil, ceph-devel

fsc->*_wq's aren't depended upon during memory reclaim.  Convert to
alloc_workqueue() w/o WQ_MEM_RECLAIM.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Sage Weil <sage@newdream.net>
Cc: ceph-devel@vger.kernel.org
---
Only compile tested.  Please feel free to take it into the subsystem
tree or simply ack - I'll route it through the wq tree.

Thanks.

 fs/ceph/super.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index 08b460a..1f6436e 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -443,13 +443,17 @@ struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt,
 		goto fail_client;
 
 	err = -ENOMEM;
-	fsc->wb_wq = create_workqueue("ceph-writeback");
+	/*
+	 * The number of concurrent works can be high but they don't need
+	 * to be processed in parallel, limit concurrency.
+	 */
+	fsc->wb_wq = alloc_workqueue("ceph-writeback", 0, 1);
 	if (fsc->wb_wq == NULL)
 		goto fail_bdi;
-	fsc->pg_inv_wq = create_singlethread_workqueue("ceph-pg-invalid");
+	fsc->pg_inv_wq = alloc_workqueue("ceph-pg-invalid", 0, 1);
 	if (fsc->pg_inv_wq == NULL)
 		goto fail_wb_wq;
-	fsc->trunc_wq = create_singlethread_workqueue("ceph-trunc");
+	fsc->trunc_wq = alloc_workqueue("ceph-trunc", 0, 1);
 	if (fsc->trunc_wq == NULL)
 		goto fail_pg_inv_wq;
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 119+ messages in thread

* [PATCH 23/32] net/ceph: make ceph_msgr_wq non-reentrant
  2011-01-03 13:49 [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
                   ` (21 preceding siblings ...)
  2011-01-03 13:49 ` [PATCH 22/32] ceph: fsc->*_wq's aren't " Tejun Heo
@ 2011-01-03 13:49 ` Tejun Heo
  2011-01-03 17:58   ` Sage Weil
  2011-01-03 13:49 ` [PATCH 24/32] dlm: dlm workqueues aren't used in memory reclaim path Tejun Heo
                   ` (9 subsequent siblings)
  32 siblings, 1 reply; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Tejun Heo, Sage Weil, ceph-devel

ceph messenger code does a rather complex dancing around multithread
workqueue to make sure the same work item isn't executed concurrently
on different CPUs.  This restriction can be provided by workqueue with
WQ_NON_REENTRANT.

Make ceph_msgr_wq non-reentrant workqueue with the default concurrency
level and remove the QUEUED/BUSY logic.

* This removes backoff handling in con_work() but it couldn't reliably
  block execution of con_work() to begin with - queue_con() can be
  called after the work started but before BUSY is set.  It seems that
  it was an optimization for a rather cold path and can be safely
  removed.

* The number of concurrent work items is bound by the number of
  connections and connetions are independent from each other.  With
  the default concurrency level, different connections will be
  executed independently.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Sage Weil <sage@newdream.net>
Cc: ceph-devel@vger.kernel.org
---
Only compile tested.  I think the dropping of backoff logic is safe
but am not completely sure.  Please verify it's actually okay.  Feel
free to take it into the subsystem tree or simply ack - I'll route it
through the wq tree.

Thanks.

 include/linux/ceph/messenger.h |    5 ----
 net/ceph/messenger.c           |   46 +--------------------------------------
 2 files changed, 2 insertions(+), 49 deletions(-)

diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h
index a108b42..c3011be 100644
--- a/include/linux/ceph/messenger.h
+++ b/include/linux/ceph/messenger.h
@@ -110,17 +110,12 @@ struct ceph_msg_pos {
 
 /*
  * ceph_connection state bit flags
- *
- * QUEUED and BUSY are used together to ensure that only a single
- * thread is currently opening, reading or writing data to the socket.
  */
 #define LOSSYTX         0  /* we can close channel or drop messages on errors */
 #define CONNECTING	1
 #define NEGOTIATING	2
 #define KEEPALIVE_PENDING      3
 #define WRITE_PENDING	4  /* we have data ready to send */
-#define QUEUED          5  /* there is work queued on this connection */
-#define BUSY            6  /* work is being done */
 #define STANDBY		8  /* no outgoing messages, socket closed.  we keep
 			    * the ceph_connection around to maintain shared
 			    * state with the peer. */
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index b6ff4a1..dff633d 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -96,7 +96,7 @@ struct workqueue_struct *ceph_msgr_wq;
 
 int ceph_msgr_init(void)
 {
-	ceph_msgr_wq = create_workqueue("ceph-msgr");
+	ceph_msgr_wq = alloc_workqueue("ceph-msgr", WQ_NON_REENTRANT, 0);
 	if (!ceph_msgr_wq) {
 		pr_err("msgr_init failed to create workqueue\n");
 		return -ENOMEM;
@@ -1920,20 +1920,6 @@ bad_tag:
 /*
  * Atomically queue work on a connection.  Bump @con reference to
  * avoid races with connection teardown.
- *
- * There is some trickery going on with QUEUED and BUSY because we
- * only want a _single_ thread operating on each connection at any
- * point in time, but we want to use all available CPUs.
- *
- * The worker thread only proceeds if it can atomically set BUSY.  It
- * clears QUEUED and does it's thing.  When it thinks it's done, it
- * clears BUSY, then rechecks QUEUED.. if it's set again, it loops
- * (tries again to set BUSY).
- *
- * To queue work, we first set QUEUED, _then_ if BUSY isn't set, we
- * try to queue work.  If that fails (work is already queued, or BUSY)
- * we give up (work also already being done or is queued) but leave QUEUED
- * set so that the worker thread will loop if necessary.
  */
 static void queue_con(struct ceph_connection *con)
 {
@@ -1948,11 +1934,7 @@ static void queue_con(struct ceph_connection *con)
 		return;
 	}
 
-	set_bit(QUEUED, &con->state);
-	if (test_bit(BUSY, &con->state)) {
-		dout("queue_con %p - already BUSY\n", con);
-		con->ops->put(con);
-	} else if (!queue_work(ceph_msgr_wq, &con->work.work)) {
+	if (!queue_delayed_work(ceph_msgr_wq, &con->work, 0)) {
 		dout("queue_con %p - already queued\n", con);
 		con->ops->put(con);
 	} else {
@@ -1967,15 +1949,6 @@ static void con_work(struct work_struct *work)
 {
 	struct ceph_connection *con = container_of(work, struct ceph_connection,
 						   work.work);
-	int backoff = 0;
-
-more:
-	if (test_and_set_bit(BUSY, &con->state) != 0) {
-		dout("con_work %p BUSY already set\n", con);
-		goto out;
-	}
-	dout("con_work %p start, clearing QUEUED\n", con);
-	clear_bit(QUEUED, &con->state);
 
 	mutex_lock(&con->mutex);
 
@@ -1994,28 +1967,13 @@ more:
 	    try_read(con) < 0 ||
 	    try_write(con) < 0) {
 		mutex_unlock(&con->mutex);
-		backoff = 1;
 		ceph_fault(con);     /* error/fault path */
 		goto done_unlocked;
 	}
 
 done:
 	mutex_unlock(&con->mutex);
-
 done_unlocked:
-	clear_bit(BUSY, &con->state);
-	dout("con->state=%lu\n", con->state);
-	if (test_bit(QUEUED, &con->state)) {
-		if (!backoff || test_bit(OPENING, &con->state)) {
-			dout("con_work %p QUEUED reset, looping\n", con);
-			goto more;
-		}
-		dout("con_work %p QUEUED reset, but just faulted\n", con);
-		clear_bit(QUEUED, &con->state);
-	}
-	dout("con_work %p done\n", con);
-
-out:
 	con->ops->put(con);
 }
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 119+ messages in thread

* [PATCH 24/32] dlm: dlm workqueues aren't used in memory reclaim path
  2011-01-03 13:49 [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
                   ` (22 preceding siblings ...)
  2011-01-03 13:49 ` [PATCH 23/32] net/ceph: make ceph_msgr_wq non-reentrant Tejun Heo
@ 2011-01-03 13:49 ` Tejun Heo
  2011-01-03 13:58     ` [Cluster-devel] " Steven Whitehouse
  2011-01-03 13:49 ` [PATCH 25/32] ext4: convert to alloc_workqueue() Tejun Heo
                   ` (8 subsequent siblings)
  32 siblings, 1 reply; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Tejun Heo, Christine Caulfield, David Teigland, cluster-devel

dlm isn't depended upon during memory reclaim and so are its two
workqueues.  Convert to alloc[_ordered]_workqueue() without
WQ_MEM_RECLAIM.  While at it, fix workqueue allocation failure
handling.  They return %NULL on failure not ERR_PTR() value.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Christine Caulfield <ccaulfie@redhat.com>
Cc: David Teigland <teigland@redhat.com>
Cc: cluster-devel@redhat.com
---
Only compile tested.  Please feel free to take it into the subsystem
tree or simply ack - I'll route it through the wq tree.

Thanks.

 fs/dlm/lowcomms.c |   19 ++++++++-----------
 1 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 37a34c2..9aad7c0 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -1430,20 +1430,17 @@ static void work_stop(void)
 
 static int work_start(void)
 {
-	int error;
-	recv_workqueue = create_workqueue("dlm_recv");
-	error = IS_ERR(recv_workqueue);
-	if (error) {
-		log_print("can't start dlm_recv %d", error);
-		return error;
+	recv_workqueue = alloc_workqueue("dlm_recv", 0, 1);
+	if (!recv_workqueue) {
+		log_print("can't start dlm_recv");
+		return -ENOMEM;
 	}
 
-	send_workqueue = create_singlethread_workqueue("dlm_send");
-	error = IS_ERR(send_workqueue);
-	if (error) {
-		log_print("can't start dlm_send %d", error);
+	send_workqueue = alloc_ordered_workqueue("dlm_send", 0);
+	if (!send_workqueue) {
+		log_print("can't start dlm_send");
 		destroy_workqueue(recv_workqueue);
-		return error;
+		return -ENOMEM;
 	}
 
 	return 0;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 119+ messages in thread

* [PATCH 25/32] ext4: convert to alloc_workqueue()
  2011-01-03 13:49 [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
                   ` (23 preceding siblings ...)
  2011-01-03 13:49 ` [PATCH 24/32] dlm: dlm workqueues aren't used in memory reclaim path Tejun Heo
@ 2011-01-03 13:49 ` Tejun Heo
  2011-01-03 13:49 ` [PATCH 26/32] ocfs2: use system_wq instead of ocfs2_quota_wq Tejun Heo
                   ` (7 subsequent siblings)
  32 siblings, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Tejun Heo, Theodore Ts'o, Andreas Dilger, linux-ext4

Convert create_workqueue() to alloc_workqueue().  This is an identity
conversion.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Andreas Dilger <adilger.kernel@dilger.ca>
Cc: linux-ext4@vger.kernel.org
---
It might be helpful to use higher max concurrency.  I don't think it
would make a lot of difference tho.  Please feel free to take it into
the subsystem tree or simply ack - I'll route it through the wq tree.

Thanks.

 fs/ext4/super.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index fb15c9c..f682c40 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3495,7 +3495,12 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 	percpu_counter_set(&sbi->s_dirtyblocks_counter, 0);
 
 no_journal:
-	EXT4_SB(sb)->dio_unwritten_wq = create_workqueue("ext4-dio-unwritten");
+	/*
+	 * The maximum number of concurrent works can be high and
+	 * concurrency isn't really necessary.  Limit it to 1.
+	 */
+	EXT4_SB(sb)->dio_unwritten_wq =
+		alloc_workqueue("ext4-dio-unwritten", WQ_MEM_RECLAIM, 1);
 	if (!EXT4_SB(sb)->dio_unwritten_wq) {
 		printk(KERN_ERR "EXT4-fs: failed to create DIO workqueue\n");
 		goto failed_mount_wq;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 119+ messages in thread

* [PATCH 26/32] ocfs2: use system_wq instead of ocfs2_quota_wq
  2011-01-03 13:49 [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
                   ` (24 preceding siblings ...)
  2011-01-03 13:49 ` [PATCH 25/32] ext4: convert to alloc_workqueue() Tejun Heo
@ 2011-01-03 13:49 ` Tejun Heo
  2011-01-03 13:49 ` [PATCH 27/32] reiserfs: make commit_wq use the default concurrency level Tejun Heo
                   ` (6 subsequent siblings)
  32 siblings, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Tejun Heo, Mark Fasheh, Joel Becker

ocfs2_quota_wq is not depended upon during memory reclaim and, with
cmwq, there's no reason to use a dedicated workqueue.  Drop
ocfs2_quota_wq and use system_wq instead.  dqi_sync_work is already
sync canceled on quota disable and no further synchronization is
necessary.

This change makes ocfs2_quota_setup/shutdown() noops.  Both functions
removed.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <joel.becker@oracle.com>
---
Only compile tested.  Please feel free to take it into the subsystem
tree or simply ack - I'll route it through the wq tree.

Thanks.

 fs/ocfs2/quota.h        |    3 ---
 fs/ocfs2/quota_global.c |   27 ++++-----------------------
 fs/ocfs2/super.c        |    7 -------
 3 files changed, 4 insertions(+), 33 deletions(-)

diff --git a/fs/ocfs2/quota.h b/fs/ocfs2/quota.h
index 196fcb5..d5ab56c 100644
--- a/fs/ocfs2/quota.h
+++ b/fs/ocfs2/quota.h
@@ -114,7 +114,4 @@ int ocfs2_local_write_dquot(struct dquot *dquot);
 extern const struct dquot_operations ocfs2_quota_operations;
 extern struct quota_format_type ocfs2_quota_format;
 
-int ocfs2_quota_setup(void);
-void ocfs2_quota_shutdown(void);
-
 #endif /* _OCFS2_QUOTA_H */
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c
index 4607923..a73f641 100644
--- a/fs/ocfs2/quota_global.c
+++ b/fs/ocfs2/quota_global.c
@@ -63,8 +63,6 @@
  *        write to gf
  */
 
-static struct workqueue_struct *ocfs2_quota_wq = NULL;
-
 static void qsync_work_fn(struct work_struct *work);
 
 static void ocfs2_global_disk2memdqb(struct dquot *dquot, void *dp)
@@ -400,8 +398,8 @@ int ocfs2_global_read_info(struct super_block *sb, int type)
 						OCFS2_QBLK_RESERVED_SPACE;
 	oinfo->dqi_gi.dqi_qtree_depth = qtree_depth(&oinfo->dqi_gi);
 	INIT_DELAYED_WORK(&oinfo->dqi_sync_work, qsync_work_fn);
-	queue_delayed_work(ocfs2_quota_wq, &oinfo->dqi_sync_work,
-			   msecs_to_jiffies(oinfo->dqi_syncms));
+	schedule_delayed_work(&oinfo->dqi_sync_work,
+			      msecs_to_jiffies(oinfo->dqi_syncms));
 
 out_err:
 	mlog_exit(status);
@@ -635,8 +633,8 @@ static void qsync_work_fn(struct work_struct *work)
 	struct super_block *sb = oinfo->dqi_gqinode->i_sb;
 
 	dquot_scan_active(sb, ocfs2_sync_dquot_helper, oinfo->dqi_type);
-	queue_delayed_work(ocfs2_quota_wq, &oinfo->dqi_sync_work,
-			   msecs_to_jiffies(oinfo->dqi_syncms));
+	schedule_delayed_work(&oinfo->dqi_sync_work,
+			      msecs_to_jiffies(oinfo->dqi_syncms));
 }
 
 /*
@@ -923,20 +921,3 @@ const struct dquot_operations ocfs2_quota_operations = {
 	.alloc_dquot	= ocfs2_alloc_dquot,
 	.destroy_dquot	= ocfs2_destroy_dquot,
 };
-
-int ocfs2_quota_setup(void)
-{
-	ocfs2_quota_wq = create_workqueue("o2quot");
-	if (!ocfs2_quota_wq)
-		return -ENOMEM;
-	return 0;
-}
-
-void ocfs2_quota_shutdown(void)
-{
-	if (ocfs2_quota_wq) {
-		flush_workqueue(ocfs2_quota_wq);
-		destroy_workqueue(ocfs2_quota_wq);
-		ocfs2_quota_wq = NULL;
-	}
-}
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index cfeab7c..23dd818 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -1639,16 +1639,11 @@ static int __init ocfs2_init(void)
 		mlog(ML_ERROR, "Unable to create ocfs2 debugfs root.\n");
 	}
 
-	status = ocfs2_quota_setup();
-	if (status)
-		goto leave;
-
 	ocfs2_set_locking_protocol();
 
 	status = register_quota_format(&ocfs2_quota_format);
 leave:
 	if (status < 0) {
-		ocfs2_quota_shutdown();
 		ocfs2_free_mem_caches();
 		exit_ocfs2_uptodate_cache();
 	}
@@ -1665,8 +1660,6 @@ static void __exit ocfs2_exit(void)
 {
 	mlog_entry_void();
 
-	ocfs2_quota_shutdown();
-
 	if (ocfs2_wq) {
 		flush_workqueue(ocfs2_wq);
 		destroy_workqueue(ocfs2_wq);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 119+ messages in thread

* [PATCH 27/32] reiserfs: make commit_wq use the default concurrency level
  2011-01-03 13:49 [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
                   ` (25 preceding siblings ...)
  2011-01-03 13:49 ` [PATCH 26/32] ocfs2: use system_wq instead of ocfs2_quota_wq Tejun Heo
@ 2011-01-03 13:49 ` Tejun Heo
  2011-01-03 13:49 ` [PATCH 28/32] xfs: convert to alloc_workqueue() Tejun Heo
                   ` (5 subsequent siblings)
  32 siblings, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Tejun Heo, reiserfs-devel

The maximum number of concurrent work items queued on commit_wq is
bound by the number of active journals.  Convert to alloc_workqueue()
and use the default concurrency level so that they can be processed in
parallel.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: reiserfs-devel@vger.kernel.org
---
Only compile tested.  Please feel free to take it into the subsystem
tree or simply ack - I'll route it through the wq tree.

Thanks.

 fs/reiserfs/journal.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index d31bce1..ee311c0 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -2883,7 +2883,7 @@ int journal_init(struct super_block *sb, const char *j_dev_name,
 	reiserfs_mounted_fs_count++;
 	if (reiserfs_mounted_fs_count <= 1) {
 		reiserfs_write_unlock(sb);
-		commit_wq = create_workqueue("reiserfs");
+		commit_wq = alloc_workqueue("reiserfs", WQ_MEM_RECLAIM, 0);
 		reiserfs_write_lock(sb);
 	}
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 119+ messages in thread

* [PATCH 28/32] xfs: convert to alloc_workqueue()
  2011-01-03 13:49 [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
                   ` (26 preceding siblings ...)
  2011-01-03 13:49 ` [PATCH 27/32] reiserfs: make commit_wq use the default concurrency level Tejun Heo
@ 2011-01-03 13:49 ` Tejun Heo
  2011-01-03 13:49 ` [PATCH 29/32] net/9p: use system_wq instead of p9_mux_wq Tejun Heo
                   ` (4 subsequent siblings)
  32 siblings, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Tejun Heo, Alex Elder, xfs-masters, Christoph Hellwig

Convert from create[_singlethread]_workqueue() to alloc_workqueue().

* xfsdatad_workqueue and xfsconvertd_workqueue are identity converted.
  Using higher concurrency limit might be useful but given the
  complexity of workqueue usage in xfs, proceeding cautiously seems
  better.

* xfs_mru_reap_wq is converted to non-ordered workqueue with max
  concurrency of 1 as the work items don't require any specific
  ordering and already have proper synchronization.  It seems it was
  singlethreaded to save worker threads, which is no longer a concern.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Alex Elder <aelder@sgi.com>
Cc: xfs-masters@oss.sgi.com
Cc: Christoph Hellwig <hch@infradead.org>
---
Only compile tested.  Please feel free to take it into the subsystem
tree or simply ack - I'll route it through the wq tree.

Thanks.

 fs/xfs/linux-2.6/xfs_buf.c |    5 +++--
 fs/xfs/xfs_mru_cache.c     |    2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c
index 4c5deb6..d6da590 100644
--- a/fs/xfs/linux-2.6/xfs_buf.c
+++ b/fs/xfs/linux-2.6/xfs_buf.c
@@ -1944,11 +1944,12 @@ xfs_buf_init(void)
 	if (!xfslogd_workqueue)
 		goto out_free_buf_zone;
 
-	xfsdatad_workqueue = create_workqueue("xfsdatad");
+	xfsdatad_workqueue = alloc_workqueue("xfsdatad", WQ_MEM_RECLAIM, 1);
 	if (!xfsdatad_workqueue)
 		goto out_destroy_xfslogd_workqueue;
 
-	xfsconvertd_workqueue = create_workqueue("xfsconvertd");
+	xfsconvertd_workqueue = alloc_workqueue("xfsconvertd",
+						WQ_MEM_RECLAIM, 1);
 	if (!xfsconvertd_workqueue)
 		goto out_destroy_xfsdatad_workqueue;
 
diff --git a/fs/xfs/xfs_mru_cache.c b/fs/xfs/xfs_mru_cache.c
index 45ce15d..2acdc77 100644
--- a/fs/xfs/xfs_mru_cache.c
+++ b/fs/xfs/xfs_mru_cache.c
@@ -309,7 +309,7 @@ xfs_mru_cache_init(void)
 	if (!xfs_mru_elem_zone)
 		goto out;
 
-	xfs_mru_reap_wq = create_singlethread_workqueue("xfs_mru_cache");
+	xfs_mru_reap_wq = alloc_workqueue("xfs_mru_cache", WQ_MEM_RECLAIM, 1);
 	if (!xfs_mru_reap_wq)
 		goto out_destroy_mru_elem_zone;
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 119+ messages in thread

* [PATCH 29/32] net/9p: use system_wq instead of p9_mux_wq
  2011-01-03 13:49 [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
                   ` (27 preceding siblings ...)
  2011-01-03 13:49 ` [PATCH 28/32] xfs: convert to alloc_workqueue() Tejun Heo
@ 2011-01-03 13:49 ` Tejun Heo
  2011-01-03 13:49 ` [PATCH 30/32] net/9p: replace p9_poll_task with a work Tejun Heo
                   ` (3 subsequent siblings)
  32 siblings, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Tejun Heo, Eric Van Hensbergen, Ron Minnich, Latchesar Ionkov,
	v9fs-developer

With cmwq, there's no reason to use a dedicated workqueue in trans_fd.
Drop p9_mux_wq and use system_wq instead.  The used work items are
already sync canceled in p9_conn_destroy() and doesn't require further
synchronization.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Eric Van Hensbergen <ericvh@gmail.com>
Cc: Ron Minnich <rminnich@sandia.gov>
Cc: Latchesar Ionkov <lucho@ionkov.net>
Cc: v9fs-developer@lists.sourceforge.net
---
Lightly tested with userland server.  Seems to work fine.  Please feel
free to take it into the subsystem tree or simply ack - I'll route it
through the wq tree.

Thanks.

 net/9p/trans_fd.c |   20 +++++---------------
 1 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index 078eb16..e9f797d 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -155,7 +155,6 @@ struct p9_conn {
 
 static DEFINE_SPINLOCK(p9_poll_lock);
 static LIST_HEAD(p9_poll_pending_list);
-static struct workqueue_struct *p9_mux_wq;
 static struct task_struct *p9_poll_task;
 
 static void p9_mux_poll_stop(struct p9_conn *m)
@@ -384,7 +383,7 @@ static void p9_read_work(struct work_struct *work)
 
 		if (n & POLLIN) {
 			P9_DPRINTK(P9_DEBUG_TRANS, "sched read work %p\n", m);
-			queue_work(p9_mux_wq, &m->rq);
+			schedule_work(&m->rq);
 		} else
 			clear_bit(Rworksched, &m->wsched);
 	} else
@@ -497,7 +496,7 @@ static void p9_write_work(struct work_struct *work)
 
 		if (n & POLLOUT) {
 			P9_DPRINTK(P9_DEBUG_TRANS, "sched write work %p\n", m);
-			queue_work(p9_mux_wq, &m->wq);
+			schedule_work(&m->wq);
 		} else
 			clear_bit(Wworksched, &m->wsched);
 	} else
@@ -629,7 +628,7 @@ static void p9_poll_mux(struct p9_conn *m)
 		P9_DPRINTK(P9_DEBUG_TRANS, "mux %p can read\n", m);
 		if (!test_and_set_bit(Rworksched, &m->wsched)) {
 			P9_DPRINTK(P9_DEBUG_TRANS, "sched read work %p\n", m);
-			queue_work(p9_mux_wq, &m->rq);
+			schedule_work(&m->rq);
 		}
 	}
 
@@ -639,7 +638,7 @@ static void p9_poll_mux(struct p9_conn *m)
 		if ((m->wsize || !list_empty(&m->unsent_req_list)) &&
 		    !test_and_set_bit(Wworksched, &m->wsched)) {
 			P9_DPRINTK(P9_DEBUG_TRANS, "sched write work %p\n", m);
-			queue_work(p9_mux_wq, &m->wq);
+			schedule_work(&m->wq);
 		}
 	}
 }
@@ -677,7 +676,7 @@ static int p9_fd_request(struct p9_client *client, struct p9_req_t *req)
 		n = p9_fd_poll(m->client, NULL);
 
 	if (n & POLLOUT && !test_and_set_bit(Wworksched, &m->wsched))
-		queue_work(p9_mux_wq, &m->wq);
+		schedule_work(&m->wq);
 
 	return 0;
 }
@@ -1083,15 +1082,8 @@ static int p9_poll_proc(void *a)
 
 int p9_trans_fd_init(void)
 {
-	p9_mux_wq = create_workqueue("v9fs");
-	if (!p9_mux_wq) {
-		printk(KERN_WARNING "v9fs: mux: creating workqueue failed\n");
-		return -ENOMEM;
-	}
-
 	p9_poll_task = kthread_run(p9_poll_proc, NULL, "v9fs-poll");
 	if (IS_ERR(p9_poll_task)) {
-		destroy_workqueue(p9_mux_wq);
 		printk(KERN_WARNING "v9fs: mux: creating poll task failed\n");
 		return PTR_ERR(p9_poll_task);
 	}
@@ -1109,6 +1101,4 @@ void p9_trans_fd_exit(void)
 	v9fs_unregister_trans(&p9_tcp_trans);
 	v9fs_unregister_trans(&p9_unix_trans);
 	v9fs_unregister_trans(&p9_fd_trans);
-
-	destroy_workqueue(p9_mux_wq);
 }
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 119+ messages in thread

* [PATCH 30/32] net/9p: replace p9_poll_task with a work
  2011-01-03 13:49 [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
                   ` (28 preceding siblings ...)
  2011-01-03 13:49 ` [PATCH 29/32] net/9p: use system_wq instead of p9_mux_wq Tejun Heo
@ 2011-01-03 13:49 ` Tejun Heo
  2011-01-03 13:49 ` [PATCH 31/32] rds/ib: use system_wq instead of rds_ib_fmr_wq Tejun Heo
                   ` (2 subsequent siblings)
  32 siblings, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Tejun Heo, Eric Van Hensbergen, Ron Minnich, Latchesar Ionkov,
	v9fs-developer

Now that cmwq can handle high concurrency, it's more efficient to use
work than a dedicated kthread.  Convert p9_poll_proc() to a work
function for p9_poll_work and make p9_pollwake() schedule it on each
poll event.  The work is sync flushed on module exit.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Eric Van Hensbergen <ericvh@gmail.com>
Cc: Ron Minnich <rminnich@sandia.gov>
Cc: Latchesar Ionkov <lucho@ionkov.net>
Cc: v9fs-developer@lists.sourceforge.net
---
Lightly tested with userland server.  Seems to work fine.  Please feel
free to take it into the subsystem tree or simply ack - I'll route it
through the wq tree.

Thanks.

 net/9p/trans_fd.c |   32 ++++++++------------------------
 1 files changed, 8 insertions(+), 24 deletions(-)

diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index e9f797d..a30471e 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -153,9 +153,11 @@ struct p9_conn {
 	unsigned long wsched;
 };
 
+static void p9_poll_workfn(struct work_struct *work);
+
 static DEFINE_SPINLOCK(p9_poll_lock);
 static LIST_HEAD(p9_poll_pending_list);
-static struct task_struct *p9_poll_task;
+static DECLARE_WORK(p9_poll_work, p9_poll_workfn);
 
 static void p9_mux_poll_stop(struct p9_conn *m)
 {
@@ -515,15 +517,14 @@ static int p9_pollwake(wait_queue_t *wait, unsigned mode, int sync, void *key)
 		container_of(wait, struct p9_poll_wait, wait);
 	struct p9_conn *m = pwait->conn;
 	unsigned long flags;
-	DECLARE_WAITQUEUE(dummy_wait, p9_poll_task);
 
 	spin_lock_irqsave(&p9_poll_lock, flags);
 	if (list_empty(&m->poll_pending_link))
 		list_add_tail(&m->poll_pending_link, &p9_poll_pending_list);
 	spin_unlock_irqrestore(&p9_poll_lock, flags);
 
-	/* perform the default wake up operation */
-	return default_wake_function(&dummy_wait, mode, sync, key);
+	schedule_work(&p9_poll_work);
+	return 1;
 }
 
 /**
@@ -1046,12 +1047,12 @@ static struct p9_trans_module p9_fd_trans = {
  *
  */
 
-static int p9_poll_proc(void *a)
+static void p9_poll_workfn(struct work_struct *work)
 {
 	unsigned long flags;
 
 	P9_DPRINTK(P9_DEBUG_TRANS, "start %p\n", current);
- repeat:
+
 	spin_lock_irqsave(&p9_poll_lock, flags);
 	while (!list_empty(&p9_poll_pending_list)) {
 		struct p9_conn *conn = list_first_entry(&p9_poll_pending_list,
@@ -1066,28 +1067,11 @@ static int p9_poll_proc(void *a)
 	}
 	spin_unlock_irqrestore(&p9_poll_lock, flags);
 
-	set_current_state(TASK_INTERRUPTIBLE);
-	if (list_empty(&p9_poll_pending_list)) {
-		P9_DPRINTK(P9_DEBUG_TRANS, "sleeping...\n");
-		schedule();
-	}
-	__set_current_state(TASK_RUNNING);
-
-	if (!kthread_should_stop())
-		goto repeat;
-
 	P9_DPRINTK(P9_DEBUG_TRANS, "finish\n");
-	return 0;
 }
 
 int p9_trans_fd_init(void)
 {
-	p9_poll_task = kthread_run(p9_poll_proc, NULL, "v9fs-poll");
-	if (IS_ERR(p9_poll_task)) {
-		printk(KERN_WARNING "v9fs: mux: creating poll task failed\n");
-		return PTR_ERR(p9_poll_task);
-	}
-
 	v9fs_register_trans(&p9_tcp_trans);
 	v9fs_register_trans(&p9_unix_trans);
 	v9fs_register_trans(&p9_fd_trans);
@@ -1097,7 +1081,7 @@ int p9_trans_fd_init(void)
 
 void p9_trans_fd_exit(void)
 {
-	kthread_stop(p9_poll_task);
+	flush_work_sync(&p9_poll_work);
 	v9fs_unregister_trans(&p9_tcp_trans);
 	v9fs_unregister_trans(&p9_unix_trans);
 	v9fs_unregister_trans(&p9_fd_trans);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 119+ messages in thread

* [PATCH 31/32] rds/ib: use system_wq instead of rds_ib_fmr_wq
  2011-01-03 13:49 [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
                   ` (29 preceding siblings ...)
  2011-01-03 13:49 ` [PATCH 30/32] net/9p: replace p9_poll_task with a work Tejun Heo
@ 2011-01-03 13:49 ` Tejun Heo
  2011-01-03 13:49 ` [PATCH 32/32] rxrpc: rxrpc_workqueue isn't used during memory reclaim Tejun Heo
  2011-01-25 14:29 ` [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
  32 siblings, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Tejun Heo, Andy Grover

With cmwq, there's no reason to use dedicated rds_ib_fmr_wq - it's not
in the memory reclaim path and the maximum number of concurrent work
items is bound by the number of devices.  Drop it and use system_wq
instead.  This rds_ib_fmr_init/exit() noops.  Both removed.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Andy Grover <andy.grover@oracle.com>
---
Only compile tested.  Please feel free to take it into the subsystem
tree or simply ack - I'll route it through the wq tree.

Thanks.

 net/rds/ib.c      |    9 +--------
 net/rds/ib.h      |    2 --
 net/rds/ib_rdma.c |   27 +++------------------------
 3 files changed, 4 insertions(+), 34 deletions(-)

diff --git a/net/rds/ib.c b/net/rds/ib.c
index 4123967..cce19f9 100644
--- a/net/rds/ib.c
+++ b/net/rds/ib.c
@@ -364,7 +364,6 @@ void rds_ib_exit(void)
 	rds_ib_sysctl_exit();
 	rds_ib_recv_exit();
 	rds_trans_unregister(&rds_ib_transport);
-	rds_ib_fmr_exit();
 }
 
 struct rds_transport rds_ib_transport = {
@@ -400,13 +399,9 @@ int rds_ib_init(void)
 
 	INIT_LIST_HEAD(&rds_ib_devices);
 
-	ret = rds_ib_fmr_init();
-	if (ret)
-		goto out;
-
 	ret = ib_register_client(&rds_ib_client);
 	if (ret)
-		goto out_fmr_exit;
+		goto out;
 
 	ret = rds_ib_sysctl_init();
 	if (ret)
@@ -430,8 +425,6 @@ out_sysctl:
 	rds_ib_sysctl_exit();
 out_ibreg:
 	rds_ib_unregister_client();
-out_fmr_exit:
-	rds_ib_fmr_exit();
 out:
 	return ret;
 }
diff --git a/net/rds/ib.h b/net/rds/ib.h
index e34ad03..4297d92 100644
--- a/net/rds/ib.h
+++ b/net/rds/ib.h
@@ -307,8 +307,6 @@ void *rds_ib_get_mr(struct scatterlist *sg, unsigned long nents,
 void rds_ib_sync_mr(void *trans_private, int dir);
 void rds_ib_free_mr(void *trans_private, int invalidate);
 void rds_ib_flush_mrs(void);
-int rds_ib_fmr_init(void);
-void rds_ib_fmr_exit(void);
 
 /* ib_recv.c */
 int rds_ib_recv_init(void);
diff --git a/net/rds/ib_rdma.c b/net/rds/ib_rdma.c
index 18a833c..819c35a 100644
--- a/net/rds/ib_rdma.c
+++ b/net/rds/ib_rdma.c
@@ -38,8 +38,6 @@
 #include "ib.h"
 #include "xlist.h"
 
-static struct workqueue_struct *rds_ib_fmr_wq;
-
 static DEFINE_PER_CPU(unsigned long, clean_list_grace);
 #define CLEAN_LIST_BUSY_BIT 0
 
@@ -307,7 +305,7 @@ static struct rds_ib_mr *rds_ib_alloc_fmr(struct rds_ib_device *rds_ibdev)
 	int err = 0, iter = 0;
 
 	if (atomic_read(&pool->dirty_count) >= pool->max_items / 10)
-		queue_delayed_work(rds_ib_fmr_wq, &pool->flush_worker, 10);
+		schedule_delayed_work(&pool->flush_worker, 10);
 
 	while (1) {
 		ibmr = rds_ib_reuse_fmr(pool);
@@ -696,24 +694,6 @@ out_nolock:
 	return ret;
 }
 
-int rds_ib_fmr_init(void)
-{
-	rds_ib_fmr_wq = create_workqueue("rds_fmr_flushd");
-	if (!rds_ib_fmr_wq)
-		return -ENOMEM;
-	return 0;
-}
-
-/*
- * By the time this is called all the IB devices should have been torn down and
- * had their pools freed.  As each pool is freed its work struct is waited on,
- * so the pool flushing work queue should be idle by the time we get here.
- */
-void rds_ib_fmr_exit(void)
-{
-	destroy_workqueue(rds_ib_fmr_wq);
-}
-
 static void rds_ib_mr_pool_flush_worker(struct work_struct *work)
 {
 	struct rds_ib_mr_pool *pool = container_of(work, struct rds_ib_mr_pool, flush_worker.work);
@@ -741,7 +721,7 @@ void rds_ib_free_mr(void *trans_private, int invalidate)
 	/* If we've pinned too many pages, request a flush */
 	if (atomic_read(&pool->free_pinned) >= pool->max_free_pinned ||
 	    atomic_read(&pool->dirty_count) >= pool->max_items / 10)
-		queue_delayed_work(rds_ib_fmr_wq, &pool->flush_worker, 10);
+		schedule_delayed_work(&pool->flush_worker, 10);
 
 	if (invalidate) {
 		if (likely(!in_interrupt())) {
@@ -749,8 +729,7 @@ void rds_ib_free_mr(void *trans_private, int invalidate)
 		} else {
 			/* We get here if the user created a MR marked
 			 * as use_once and invalidate at the same time. */
-			queue_delayed_work(rds_ib_fmr_wq,
-					   &pool->flush_worker, 10);
+			schedule_delayed_work(&pool->flush_worker, 10);
 		}
 	}
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 119+ messages in thread

* [PATCH 32/32] rxrpc: rxrpc_workqueue isn't used during memory reclaim
  2011-01-03 13:49 [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
                   ` (30 preceding siblings ...)
  2011-01-03 13:49 ` [PATCH 31/32] rds/ib: use system_wq instead of rds_ib_fmr_wq Tejun Heo
@ 2011-01-03 13:49 ` Tejun Heo
  2011-01-25 14:29 ` [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
  32 siblings, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 13:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Tejun Heo, David Howells, linux-afs

rxrpc_workqueue isn't depended upon while reclaiming memory.  Convert
to alloc_workqueue() without WQ_MEM_RECLAIM.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: David Howells <dhowells@redhat.com>
Cc: linux-afs@lists.infradead.org
---
Only compile tested.  Please feel free to take it into the subsystem
tree or simply ack - I'll route it through the wq tree.

Thanks.

 net/rxrpc/af_rxrpc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c
index 0b9bb20..74c064c 100644
--- a/net/rxrpc/af_rxrpc.c
+++ b/net/rxrpc/af_rxrpc.c
@@ -808,7 +808,7 @@ static int __init af_rxrpc_init(void)
 		goto error_call_jar;
 	}
 
-	rxrpc_workqueue = create_workqueue("krxrpcd");
+	rxrpc_workqueue = alloc_workqueue("krxrpcd", 0, 1);
 	if (!rxrpc_workqueue) {
 		printk(KERN_NOTICE "RxRPC: Failed to allocate work queue\n");
 		goto error_work_queue;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 119+ messages in thread

* Re: [PATCH 24/32] dlm: dlm workqueues aren't used in memory reclaim path
  2011-01-03 13:49 ` [PATCH 24/32] dlm: dlm workqueues aren't used in memory reclaim path Tejun Heo
@ 2011-01-03 13:58     ` Steven Whitehouse
  0 siblings, 0 replies; 119+ messages in thread
From: Steven Whitehouse @ 2011-01-03 13:58 UTC (permalink / raw)
  To: Tejun Heo
  Cc: linux-kernel, Christine Caulfield, David Teigland, cluster-devel

Hi,

You already acked a patch to do this, which is in the DLM git tree,
waiting for the next merge window:

http://git.kernel.org/?p=linux/kernel/git/teigland/dlm.git;a=commitdiff;h=dcce240ead802d42b1e45ad2fcb2ed4a399cb255

Steve.

On Mon, 2011-01-03 at 14:49 +0100, Tejun Heo wrote:
> dlm isn't depended upon during memory reclaim and so are its two
> workqueues.  Convert to alloc[_ordered]_workqueue() without
> WQ_MEM_RECLAIM.  While at it, fix workqueue allocation failure
> handling.  They return %NULL on failure not ERR_PTR() value.
> 
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: Christine Caulfield <ccaulfie@redhat.com>
> Cc: David Teigland <teigland@redhat.com>
> Cc: cluster-devel@redhat.com
> ---
> Only compile tested.  Please feel free to take it into the subsystem
> tree or simply ack - I'll route it through the wq tree.
> 
> Thanks.
> 
>  fs/dlm/lowcomms.c |   19 ++++++++-----------
>  1 files changed, 8 insertions(+), 11 deletions(-)
> 
> diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
> index 37a34c2..9aad7c0 100644
> --- a/fs/dlm/lowcomms.c
> +++ b/fs/dlm/lowcomms.c
> @@ -1430,20 +1430,17 @@ static void work_stop(void)
>  
>  static int work_start(void)
>  {
> -	int error;
> -	recv_workqueue = create_workqueue("dlm_recv");
> -	error = IS_ERR(recv_workqueue);
> -	if (error) {
> -		log_print("can't start dlm_recv %d", error);
> -		return error;
> +	recv_workqueue = alloc_workqueue("dlm_recv", 0, 1);
> +	if (!recv_workqueue) {
> +		log_print("can't start dlm_recv");
> +		return -ENOMEM;
>  	}
>  
> -	send_workqueue = create_singlethread_workqueue("dlm_send");
> -	error = IS_ERR(send_workqueue);
> -	if (error) {
> -		log_print("can't start dlm_send %d", error);
> +	send_workqueue = alloc_ordered_workqueue("dlm_send", 0);
> +	if (!send_workqueue) {
> +		log_print("can't start dlm_send");
>  		destroy_workqueue(recv_workqueue);
> -		return error;
> +		return -ENOMEM;
>  	}
>  
>  	return 0;



^ permalink raw reply	[flat|nested] 119+ messages in thread

* [Cluster-devel] [PATCH 24/32] dlm: dlm workqueues aren't used in memory reclaim path
@ 2011-01-03 13:58     ` Steven Whitehouse
  0 siblings, 0 replies; 119+ messages in thread
From: Steven Whitehouse @ 2011-01-03 13:58 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Hi,

You already acked a patch to do this, which is in the DLM git tree,
waiting for the next merge window:

http://git.kernel.org/?p=linux/kernel/git/teigland/dlm.git;a=commitdiff;h=dcce240ead802d42b1e45ad2fcb2ed4a399cb255

Steve.

On Mon, 2011-01-03 at 14:49 +0100, Tejun Heo wrote:
> dlm isn't depended upon during memory reclaim and so are its two
> workqueues.  Convert to alloc[_ordered]_workqueue() without
> WQ_MEM_RECLAIM.  While at it, fix workqueue allocation failure
> handling.  They return %NULL on failure not ERR_PTR() value.
> 
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: Christine Caulfield <ccaulfie@redhat.com>
> Cc: David Teigland <teigland@redhat.com>
> Cc: cluster-devel at redhat.com
> ---
> Only compile tested.  Please feel free to take it into the subsystem
> tree or simply ack - I'll route it through the wq tree.
> 
> Thanks.
> 
>  fs/dlm/lowcomms.c |   19 ++++++++-----------
>  1 files changed, 8 insertions(+), 11 deletions(-)
> 
> diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
> index 37a34c2..9aad7c0 100644
> --- a/fs/dlm/lowcomms.c
> +++ b/fs/dlm/lowcomms.c
> @@ -1430,20 +1430,17 @@ static void work_stop(void)
>  
>  static int work_start(void)
>  {
> -	int error;
> -	recv_workqueue = create_workqueue("dlm_recv");
> -	error = IS_ERR(recv_workqueue);
> -	if (error) {
> -		log_print("can't start dlm_recv %d", error);
> -		return error;
> +	recv_workqueue = alloc_workqueue("dlm_recv", 0, 1);
> +	if (!recv_workqueue) {
> +		log_print("can't start dlm_recv");
> +		return -ENOMEM;
>  	}
>  
> -	send_workqueue = create_singlethread_workqueue("dlm_send");
> -	error = IS_ERR(send_workqueue);
> -	if (error) {
> -		log_print("can't start dlm_send %d", error);
> +	send_workqueue = alloc_ordered_workqueue("dlm_send", 0);
> +	if (!send_workqueue) {
> +		log_print("can't start dlm_send");
>  		destroy_workqueue(recv_workqueue);
> -		return error;
> +		return -ENOMEM;
>  	}
>  
>  	return 0;




^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 03/32] block: make kblockd_workqueue smarter
  2011-01-03 13:49 ` [PATCH 03/32] block: make kblockd_workqueue smarter Tejun Heo
@ 2011-01-03 14:00   ` Jens Axboe
  0 siblings, 0 replies; 119+ messages in thread
From: Jens Axboe @ 2011-01-03 14:00 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-kernel

On 2011-01-03 14:49, Tejun Heo wrote:
> kblockd is used for unplugging and may affect IO latency and
> throughput and the max number of concurrent work items are bound by
> the number of block devices.  Make it HIGHPRI workqueue w/ default max
> concurrency.

Thanks Tejun, I've pulled the two into the 2.6.38 tree.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 24/32] dlm: dlm workqueues aren't used in memory reclaim path
  2011-01-03 13:58     ` [Cluster-devel] " Steven Whitehouse
  (?)
@ 2011-01-03 14:01     ` Tejun Heo
  2011-01-03 14:21         ` [Cluster-devel] " Steven Whitehouse
  -1 siblings, 1 reply; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 14:01 UTC (permalink / raw)
  To: Steven Whitehouse
  Cc: linux-kernel, Christine Caulfield, David Teigland, cluster-devel

On Mon, Jan 03, 2011 at 01:58:27PM +0000, Steven Whitehouse wrote:
> Hi,
> 
> You already acked a patch to do this, which is in the DLM git tree,
> waiting for the next merge window:
> 
> http://git.kernel.org/?p=linux/kernel/git/teigland/dlm.git;a=commitdiff;h=dcce240ead802d42b1e45ad2fcb2ed4a399cb255

Ooh, I see.  Hmmm... maybe I've asked this before but do you really
need WQ_MEM_RECLAIM there?  Is dlm used during memory reclaim?

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 24/32] dlm: dlm workqueues aren't used in memory reclaim path
  2011-01-03 14:01     ` Tejun Heo
@ 2011-01-03 14:21         ` Steven Whitehouse
  0 siblings, 0 replies; 119+ messages in thread
From: Steven Whitehouse @ 2011-01-03 14:21 UTC (permalink / raw)
  To: Tejun Heo
  Cc: linux-kernel, Christine Caulfield, David Teigland, cluster-devel

Hi,

On Mon, 2011-01-03 at 15:01 +0100, Tejun Heo wrote:
> On Mon, Jan 03, 2011 at 01:58:27PM +0000, Steven Whitehouse wrote:
> > Hi,
> > 
> > You already acked a patch to do this, which is in the DLM git tree,
> > waiting for the next merge window:
> > 
> > http://git.kernel.org/?p=linux/kernel/git/teigland/dlm.git;a=commitdiff;h=dcce240ead802d42b1e45ad2fcb2ed4a399cb255
> 
> Ooh, I see.  Hmmm... maybe I've asked this before but do you really
> need WQ_MEM_RECLAIM there?  Is dlm used during memory reclaim?
> 
> Thanks.
> 

Yes, it is in case of deallocation of inodes, so we have to be careful
about that,

Steve.



^ permalink raw reply	[flat|nested] 119+ messages in thread

* [Cluster-devel] [PATCH 24/32] dlm: dlm workqueues aren't used in memory reclaim path
@ 2011-01-03 14:21         ` Steven Whitehouse
  0 siblings, 0 replies; 119+ messages in thread
From: Steven Whitehouse @ 2011-01-03 14:21 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Hi,

On Mon, 2011-01-03 at 15:01 +0100, Tejun Heo wrote:
> On Mon, Jan 03, 2011 at 01:58:27PM +0000, Steven Whitehouse wrote:
> > Hi,
> > 
> > You already acked a patch to do this, which is in the DLM git tree,
> > waiting for the next merge window:
> > 
> > http://git.kernel.org/?p=linux/kernel/git/teigland/dlm.git;a=commitdiff;h=dcce240ead802d42b1e45ad2fcb2ed4a399cb255
> 
> Ooh, I see.  Hmmm... maybe I've asked this before but do you really
> need WQ_MEM_RECLAIM there?  Is dlm used during memory reclaim?
> 
> Thanks.
> 

Yes, it is in case of deallocation of inodes, so we have to be careful
about that,

Steve.




^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 24/32] dlm: dlm workqueues aren't used in memory reclaim path
  2011-01-03 14:21         ` [Cluster-devel] " Steven Whitehouse
  (?)
@ 2011-01-03 14:27         ` Tejun Heo
  2011-01-03 14:39             ` [Cluster-devel] " Steven Whitehouse
  -1 siblings, 1 reply; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 14:27 UTC (permalink / raw)
  To: Steven Whitehouse
  Cc: linux-kernel, Christine Caulfield, David Teigland, cluster-devel

Hello again,

On Mon, Jan 03, 2011 at 02:21:29PM +0000, Steven Whitehouse wrote:
> > Ooh, I see.  Hmmm... maybe I've asked this before but do you really
> > need WQ_MEM_RECLAIM there?  Is dlm used during memory reclaim?
> 
> Yes, it is in case of deallocation of inodes, so we have to be careful
> about that,

I see.  I'm still slightly unsure about the WQ_MEM_RECLAIM rules when
it comes to distributed file systems and stuff related to them, but I
think it basically comes down to whether the code can be in the swap
path or not.  e.g. for nfs backed write shared mapped files, nfs
definitely can be used during memory reclaim _but_ it's not guaranteed
to make forward progress under memory pressure and thus can't be
depended upon and shouldn't be used for swap.  IOW, it may free memory
but it's not in the critical path which should guarantee forward
progress.  Isn't dlm the same case?

Thank you.

-- 
tejun

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 24/32] dlm: dlm workqueues aren't used in memory reclaim path
  2011-01-03 14:27         ` Tejun Heo
@ 2011-01-03 14:39             ` Steven Whitehouse
  0 siblings, 0 replies; 119+ messages in thread
From: Steven Whitehouse @ 2011-01-03 14:39 UTC (permalink / raw)
  To: Tejun Heo
  Cc: linux-kernel, Christine Caulfield, David Teigland, cluster-devel

Hi,

On Mon, 2011-01-03 at 15:27 +0100, Tejun Heo wrote:
> Hello again,
> 
> On Mon, Jan 03, 2011 at 02:21:29PM +0000, Steven Whitehouse wrote:
> > > Ooh, I see.  Hmmm... maybe I've asked this before but do you really
> > > need WQ_MEM_RECLAIM there?  Is dlm used during memory reclaim?
> > 
> > Yes, it is in case of deallocation of inodes, so we have to be careful
> > about that,
> 
> I see.  I'm still slightly unsure about the WQ_MEM_RECLAIM rules when
> it comes to distributed file systems and stuff related to them, but I
> think it basically comes down to whether the code can be in the swap
> path or not.  e.g. for nfs backed write shared mapped files, nfs
> definitely can be used during memory reclaim _but_ it's not guaranteed
> to make forward progress under memory pressure and thus can't be
> depended upon and shouldn't be used for swap.  IOW, it may free memory
> but it's not in the critical path which should guarantee forward
> progress.  Isn't dlm the same case?
> 
> Thank you.
> 

No, the issue arises in case an inode is being ejected from cache with a
0 link count (and this need deallocation). At this point the dlm is
required in order to coordinate which node will perform the
deallocation, but if it blocks on memory reclaim (via the fs, so
GFP_NOFS is ok, but GFP_KERNEL is not) then it can land up calling back
into the fs via a shrink of the dcache which can potentially then also
call back into the dlm.

Since there is no workqueue option to indicate that GFP_NOFS is ok, but
GFP_KERNEL is not, I think in the workqueue case we must mark it as
WQ_MEM_RECLAIM. So far as I can tell thats a limitation of task creation
which was the reason for the pre-allocated rescuer thread. I'd rather be
safe than sorry in this case,

Steve.



^ permalink raw reply	[flat|nested] 119+ messages in thread

* [Cluster-devel] [PATCH 24/32] dlm: dlm workqueues aren't used in memory reclaim path
@ 2011-01-03 14:39             ` Steven Whitehouse
  0 siblings, 0 replies; 119+ messages in thread
From: Steven Whitehouse @ 2011-01-03 14:39 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Hi,

On Mon, 2011-01-03 at 15:27 +0100, Tejun Heo wrote:
> Hello again,
> 
> On Mon, Jan 03, 2011 at 02:21:29PM +0000, Steven Whitehouse wrote:
> > > Ooh, I see.  Hmmm... maybe I've asked this before but do you really
> > > need WQ_MEM_RECLAIM there?  Is dlm used during memory reclaim?
> > 
> > Yes, it is in case of deallocation of inodes, so we have to be careful
> > about that,
> 
> I see.  I'm still slightly unsure about the WQ_MEM_RECLAIM rules when
> it comes to distributed file systems and stuff related to them, but I
> think it basically comes down to whether the code can be in the swap
> path or not.  e.g. for nfs backed write shared mapped files, nfs
> definitely can be used during memory reclaim _but_ it's not guaranteed
> to make forward progress under memory pressure and thus can't be
> depended upon and shouldn't be used for swap.  IOW, it may free memory
> but it's not in the critical path which should guarantee forward
> progress.  Isn't dlm the same case?
> 
> Thank you.
> 

No, the issue arises in case an inode is being ejected from cache with a
0 link count (and this need deallocation). At this point the dlm is
required in order to coordinate which node will perform the
deallocation, but if it blocks on memory reclaim (via the fs, so
GFP_NOFS is ok, but GFP_KERNEL is not) then it can land up calling back
into the fs via a shrink of the dcache which can potentially then also
call back into the dlm.

Since there is no workqueue option to indicate that GFP_NOFS is ok, but
GFP_KERNEL is not, I think in the workqueue case we must mark it as
WQ_MEM_RECLAIM. So far as I can tell thats a limitation of task creation
which was the reason for the pre-allocated rescuer thread. I'd rather be
safe than sorry in this case,

Steve.




^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 10/32] input/tps6507x-ts: use system_wq instead of dedicated workqueue
  2011-01-03 13:49 ` [PATCH 10/32] input/tps6507x-ts: use system_wq instead of dedicated workqueue Tejun Heo
@ 2011-01-03 14:39   ` Dan Carpenter
  2011-01-03 16:34     ` Todd Fischer
  0 siblings, 1 reply; 119+ messages in thread
From: Dan Carpenter @ 2011-01-03 14:39 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-kernel, Dmitry Torokhov, linux-input, Todd Fischer

On Mon, Jan 03, 2011 at 02:49:33PM +0100, Tejun Heo wrote:
> With cmwq, there's no reason to use a separate workqueue.  Drop
> tps6507x_ts->wq and use system_wq instead.
> 
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> Cc: linux-input@vger.kernel.org
> Cc: Dan Carpenter <error27@gmail.com>
> Cc: Todd Fischer <todd.fischer@ridgerun.com>
> ---
> Only compile tested.  Please feel free to take it into the subsystem
> tree or simply ack - I'll route it through the wq tree.
> 

This is that driver that polls every 30 ms.  :/  Todd, is there no way
to avoid this?  What was the status on that?

regards,
dan carpenter



^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 24/32] dlm: dlm workqueues aren't used in memory reclaim path
  2011-01-03 14:39             ` [Cluster-devel] " Steven Whitehouse
  (?)
@ 2011-01-03 14:44             ` Tejun Heo
  -1 siblings, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-03 14:44 UTC (permalink / raw)
  To: Steven Whitehouse
  Cc: linux-kernel, Christine Caulfield, David Teigland, cluster-devel

Hello,

On Mon, Jan 03, 2011 at 02:39:19PM +0000, Steven Whitehouse wrote:
> No, the issue arises in case an inode is being ejected from cache with a
> 0 link count (and this need deallocation). At this point the dlm is
> required in order to coordinate which node will perform the
> deallocation, but if it blocks on memory reclaim (via the fs, so
> GFP_NOFS is ok, but GFP_KERNEL is not) then it can land up calling back
> into the fs via a shrink of the dcache which can potentially then also
> call back into the dlm.

I see.  Thanks for the explanation.

> Since there is no workqueue option to indicate that GFP_NOFS is ok, but
> GFP_KERNEL is not, I think in the workqueue case we must mark it as
> WQ_MEM_RECLAIM. So far as I can tell thats a limitation of task creation
> which was the reason for the pre-allocated rescuer thread. I'd rather be
> safe than sorry in this case,

Yeap, in such case, WQ_MEM_RECLAIM seems like the right choice.  It
may call into GFP_KERNEL path again, but the dependency chain isn't
hard.  It will be broken pretty soon and rescuer will kick in.

As the case is rather special, it might be a good idea to explain why
WQ_MEM_RECLAIM is necessary for future references?

Thank you.

-- 
tejun

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 10/32] input/tps6507x-ts: use system_wq instead of dedicated workqueue
  2011-01-03 14:39   ` Dan Carpenter
@ 2011-01-03 16:34     ` Todd Fischer
  2011-01-25 14:19       ` Tejun Heo
  0 siblings, 1 reply; 119+ messages in thread
From: Todd Fischer @ 2011-01-03 16:34 UTC (permalink / raw)
  To: Dan Carpenter, Tejun Heo, linux-kernel, Dmitry Torokhov, linux-input

Hi Dan,

Polling is only necessary because I was given brain dead hardware.  I 
was expecting updated hardware with the interrupt signal connected 
properly, but haven't received it yet.

Any reasonable hardware will not need tps6507x-ts polling.  I was under 
the impression I could only push patches that I have tested.  Since I 
haven't tested an interrupt version of the driver, I didn't include a 
patch that removes the polling and replaces it with interrupts.

I have another customer planning on using the TPS6507x chip for touch 
screen.  I expect their hardware in around 3 weeks.

Todd

On 01/03/2011 07:39 AM, Dan Carpenter wrote:
> On Mon, Jan 03, 2011 at 02:49:33PM +0100, Tejun Heo wrote:
>> With cmwq, there's no reason to use a separate workqueue.  Drop
>> tps6507x_ts->wq and use system_wq instead.
>>
>> Signed-off-by: Tejun Heo<tj@kernel.org>
>> Cc: Dmitry Torokhov<dmitry.torokhov@gmail.com>
>> Cc: linux-input@vger.kernel.org
>> Cc: Dan Carpenter<error27@gmail.com>
>> Cc: Todd Fischer<todd.fischer@ridgerun.com>
>> ---
>> Only compile tested.  Please feel free to take it into the subsystem
>> tree or simply ack - I'll route it through the wq tree.
>>
> This is that driver that polls every 30 ms.  :/  Todd, is there no way
> to avoid this?  What was the status on that?
>
> regards,
> dan carpenter
>
>


^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 20/32] video/msm_fb: use system_wq instead of dedicated workqueues
  2011-01-03 13:49 ` [PATCH 20/32] video/msm_fb: " Tejun Heo
@ 2011-01-03 17:06       ` Stanislaw Gruszka
  2011-01-25 23:21   ` David Brown
  1 sibling, 0 replies; 119+ messages in thread
From: Stanislaw Gruszka @ 2011-01-03 17:06 UTC (permalink / raw)
  To: Tejun Heo
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, Stanislaw Gruszka,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, David Brown, Daniel Walker,
	Bryan Huntsman, linux-arm-msm-u79uwXL29TY76Z2rM5mHXA

On Mon, Jan 03, 2011 at 02:49:43PM +0100, Tejun Heo wrote:
> With cmwq, there's no reason to use separate workqueues.  Drop
> msmfb_info->resume_workqueue and use system_wq instead.
> 
> Signed-off-by: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Cc: Stanislaw Gruszka <stf_xl-5tc4TXWwyLM@public.gmane.org>
I'm not the right person, CC according to MAINTAINERS

> Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> ---
> Only compile tested.  Please feel free to take it into the subsystem
> tree or simply ack - I'll route it through the wq tree.
> 
> Thanks.
> 
>  drivers/video/msm/msm_fb.c |   11 +----------
>  1 files changed, 1 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/video/msm/msm_fb.c b/drivers/video/msm/msm_fb.c
> index debe593..5436aeb 100644
> --- a/drivers/video/msm/msm_fb.c
> +++ b/drivers/video/msm/msm_fb.c
> @@ -81,7 +81,6 @@ struct msmfb_info {
>  	spinlock_t update_lock;
>  	struct mutex panel_init_lock;
>  	wait_queue_head_t frame_wq;
> -	struct workqueue_struct *resume_workqueue;
>  	struct work_struct resume_work;
>  	struct msmfb_callback dma_callback;
>  	struct msmfb_callback vsync_callback;
> @@ -111,7 +110,7 @@ static void msmfb_handle_dma_interrupt(struct msmfb_callback *callback)
>  	if (msmfb->sleeping == UPDATING &&
>  	    msmfb->frame_done == msmfb->update_frame) {
>  		DLOG(SUSPEND_RESUME, "full update completed\n");
> -		queue_work(msmfb->resume_workqueue, &msmfb->resume_work);
> +		schedule_work(&msmfb->resume_work);
>  	}
>  	spin_unlock_irqrestore(&msmfb->update_lock, irq_flags);
>  	wake_up(&msmfb->frame_wq);
> @@ -559,12 +558,6 @@ static int msmfb_probe(struct platform_device *pdev)
>  	spin_lock_init(&msmfb->update_lock);
>  	mutex_init(&msmfb->panel_init_lock);
>  	init_waitqueue_head(&msmfb->frame_wq);
> -	msmfb->resume_workqueue = create_workqueue("panel_on");
> -	if (msmfb->resume_workqueue == NULL) {
> -		printk(KERN_ERR "failed to create panel_on workqueue\n");
> -		ret = -ENOMEM;
> -		goto error_create_workqueue;
> -	}
>  	INIT_WORK(&msmfb->resume_work, power_on_panel);
>  	msmfb->black = kzalloc(msmfb->fb->var.bits_per_pixel*msmfb->xres,
>  			       GFP_KERNEL);
> @@ -589,8 +582,6 @@ static int msmfb_probe(struct platform_device *pdev)
>  	return 0;
>  
>  error_register_framebuffer:
> -	destroy_workqueue(msmfb->resume_workqueue);
> -error_create_workqueue:
>  	iounmap(fb->screen_base);
>  error_setup_fbmem:
>  	framebuffer_release(msmfb->fb);
> -- 
> 1.7.1
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 20/32] video/msm_fb: use system_wq instead of dedicated workqueues
@ 2011-01-03 17:06       ` Stanislaw Gruszka
  0 siblings, 0 replies; 119+ messages in thread
From: Stanislaw Gruszka @ 2011-01-03 17:06 UTC (permalink / raw)
  To: Tejun Heo
  Cc: linux-kernel, Stanislaw Gruszka, linux-usb, David Brown,
	Daniel Walker, Bryan Huntsman, linux-arm-msm

On Mon, Jan 03, 2011 at 02:49:43PM +0100, Tejun Heo wrote:
> With cmwq, there's no reason to use separate workqueues.  Drop
> msmfb_info->resume_workqueue and use system_wq instead.
> 
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: Stanislaw Gruszka <stf_xl@wp.pl>
I'm not the right person, CC according to MAINTAINERS

> Cc: linux-usb@vger.kernel.org
> ---
> Only compile tested.  Please feel free to take it into the subsystem
> tree or simply ack - I'll route it through the wq tree.
> 
> Thanks.
> 
>  drivers/video/msm/msm_fb.c |   11 +----------
>  1 files changed, 1 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/video/msm/msm_fb.c b/drivers/video/msm/msm_fb.c
> index debe593..5436aeb 100644
> --- a/drivers/video/msm/msm_fb.c
> +++ b/drivers/video/msm/msm_fb.c
> @@ -81,7 +81,6 @@ struct msmfb_info {
>  	spinlock_t update_lock;
>  	struct mutex panel_init_lock;
>  	wait_queue_head_t frame_wq;
> -	struct workqueue_struct *resume_workqueue;
>  	struct work_struct resume_work;
>  	struct msmfb_callback dma_callback;
>  	struct msmfb_callback vsync_callback;
> @@ -111,7 +110,7 @@ static void msmfb_handle_dma_interrupt(struct msmfb_callback *callback)
>  	if (msmfb->sleeping == UPDATING &&
>  	    msmfb->frame_done == msmfb->update_frame) {
>  		DLOG(SUSPEND_RESUME, "full update completed\n");
> -		queue_work(msmfb->resume_workqueue, &msmfb->resume_work);
> +		schedule_work(&msmfb->resume_work);
>  	}
>  	spin_unlock_irqrestore(&msmfb->update_lock, irq_flags);
>  	wake_up(&msmfb->frame_wq);
> @@ -559,12 +558,6 @@ static int msmfb_probe(struct platform_device *pdev)
>  	spin_lock_init(&msmfb->update_lock);
>  	mutex_init(&msmfb->panel_init_lock);
>  	init_waitqueue_head(&msmfb->frame_wq);
> -	msmfb->resume_workqueue = create_workqueue("panel_on");
> -	if (msmfb->resume_workqueue == NULL) {
> -		printk(KERN_ERR "failed to create panel_on workqueue\n");
> -		ret = -ENOMEM;
> -		goto error_create_workqueue;
> -	}
>  	INIT_WORK(&msmfb->resume_work, power_on_panel);
>  	msmfb->black = kzalloc(msmfb->fb->var.bits_per_pixel*msmfb->xres,
>  			       GFP_KERNEL);
> @@ -589,8 +582,6 @@ static int msmfb_probe(struct platform_device *pdev)
>  	return 0;
>  
>  error_register_framebuffer:
> -	destroy_workqueue(msmfb->resume_workqueue);
> -error_create_workqueue:
>  	iounmap(fb->screen_base);
>  error_setup_fbmem:
>  	framebuffer_release(msmfb->fb);
> -- 
> 1.7.1
> 
> 

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 17/32] scsi/ibmvstgt: use system_wq instead of vtgtd workqueue
  2011-01-03 13:49 ` [PATCH 17/32] scsi/ibmvstgt: use system_wq instead of vtgtd workqueue Tejun Heo
@ 2011-01-03 17:45   ` Bart Van Assche
  2011-01-04  5:20     ` Tejun Heo
  2011-01-24 16:09   ` Bart Van Assche
  1 sibling, 1 reply; 119+ messages in thread
From: Bart Van Assche @ 2011-01-03 17:45 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-kernel, FUJITA Tomonori, James E.J. Bottomley, linux-scsi

On Mon, Jan 3, 2011 at 2:49 PM, Tejun Heo <tj@kernel.org> wrote:
> The target driver is not in the memory reclaim path and doesn't need a
> dedicated workqueue.  Drop vtgtd and use system_wq instead.  The used
> work item is sync flushed on removal.

[ ... ]

Hi Tejun,

No matter which storage target will go upstream, I'm afraid that this
patch will conflict with it. See e.g.
http://dchs.spinics.net/lists/linux-scsi/msg49105.html.

Bart.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 23/32] net/ceph: make ceph_msgr_wq non-reentrant
  2011-01-03 13:49 ` [PATCH 23/32] net/ceph: make ceph_msgr_wq non-reentrant Tejun Heo
@ 2011-01-03 17:58   ` Sage Weil
  0 siblings, 0 replies; 119+ messages in thread
From: Sage Weil @ 2011-01-03 17:58 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-kernel, ceph-devel

On Mon, 3 Jan 2011, Tejun Heo wrote:
> ceph messenger code does a rather complex dancing around multithread
> workqueue to make sure the same work item isn't executed concurrently
> on different CPUs.  This restriction can be provided by workqueue with
> WQ_NON_REENTRANT.
> 
> Make ceph_msgr_wq non-reentrant workqueue with the default concurrency
> level and remove the QUEUED/BUSY logic.
> 
> * This removes backoff handling in con_work() but it couldn't reliably
>   block execution of con_work() to begin with - queue_con() can be
>   called after the work started but before BUSY is set.  It seems that
>   it was an optimization for a rather cold path and can be safely
>   removed.
> 
> * The number of concurrent work items is bound by the number of
>   connections and connetions are independent from each other.  With
>   the default concurrency level, different connections will be
>   executed independently.
> 
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: Sage Weil <sage@newdream.net>
> Cc: ceph-devel@vger.kernel.org
> ---
> Only compile tested.  I think the dropping of backoff logic is safe
> but am not completely sure.  Please verify it's actually okay.  Feel
> free to take it into the subsystem tree or simply ack - I'll route it
> through the wq tree.

Tejun- this is a very welcome simplification!  I'll take it through the 
ceph tree, as I want to test it thoroughly and make sure the backoff 
change is correct (there was some subtlety there, IIRC).

Thanks!
sage


> 
> Thanks.
> 
>  include/linux/ceph/messenger.h |    5 ----
>  net/ceph/messenger.c           |   46 +--------------------------------------
>  2 files changed, 2 insertions(+), 49 deletions(-)
> 
> diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h
> index a108b42..c3011be 100644
> --- a/include/linux/ceph/messenger.h
> +++ b/include/linux/ceph/messenger.h
> @@ -110,17 +110,12 @@ struct ceph_msg_pos {
>  
>  /*
>   * ceph_connection state bit flags
> - *
> - * QUEUED and BUSY are used together to ensure that only a single
> - * thread is currently opening, reading or writing data to the socket.
>   */
>  #define LOSSYTX         0  /* we can close channel or drop messages on errors */
>  #define CONNECTING	1
>  #define NEGOTIATING	2
>  #define KEEPALIVE_PENDING      3
>  #define WRITE_PENDING	4  /* we have data ready to send */
> -#define QUEUED          5  /* there is work queued on this connection */
> -#define BUSY            6  /* work is being done */
>  #define STANDBY		8  /* no outgoing messages, socket closed.  we keep
>  			    * the ceph_connection around to maintain shared
>  			    * state with the peer. */
> diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
> index b6ff4a1..dff633d 100644
> --- a/net/ceph/messenger.c
> +++ b/net/ceph/messenger.c
> @@ -96,7 +96,7 @@ struct workqueue_struct *ceph_msgr_wq;
>  
>  int ceph_msgr_init(void)
>  {
> -	ceph_msgr_wq = create_workqueue("ceph-msgr");
> +	ceph_msgr_wq = alloc_workqueue("ceph-msgr", WQ_NON_REENTRANT, 0);
>  	if (!ceph_msgr_wq) {
>  		pr_err("msgr_init failed to create workqueue\n");
>  		return -ENOMEM;
> @@ -1920,20 +1920,6 @@ bad_tag:
>  /*
>   * Atomically queue work on a connection.  Bump @con reference to
>   * avoid races with connection teardown.
> - *
> - * There is some trickery going on with QUEUED and BUSY because we
> - * only want a _single_ thread operating on each connection at any
> - * point in time, but we want to use all available CPUs.
> - *
> - * The worker thread only proceeds if it can atomically set BUSY.  It
> - * clears QUEUED and does it's thing.  When it thinks it's done, it
> - * clears BUSY, then rechecks QUEUED.. if it's set again, it loops
> - * (tries again to set BUSY).
> - *
> - * To queue work, we first set QUEUED, _then_ if BUSY isn't set, we
> - * try to queue work.  If that fails (work is already queued, or BUSY)
> - * we give up (work also already being done or is queued) but leave QUEUED
> - * set so that the worker thread will loop if necessary.
>   */
>  static void queue_con(struct ceph_connection *con)
>  {
> @@ -1948,11 +1934,7 @@ static void queue_con(struct ceph_connection *con)
>  		return;
>  	}
>  
> -	set_bit(QUEUED, &con->state);
> -	if (test_bit(BUSY, &con->state)) {
> -		dout("queue_con %p - already BUSY\n", con);
> -		con->ops->put(con);
> -	} else if (!queue_work(ceph_msgr_wq, &con->work.work)) {
> +	if (!queue_delayed_work(ceph_msgr_wq, &con->work, 0)) {
>  		dout("queue_con %p - already queued\n", con);
>  		con->ops->put(con);
>  	} else {
> @@ -1967,15 +1949,6 @@ static void con_work(struct work_struct *work)
>  {
>  	struct ceph_connection *con = container_of(work, struct ceph_connection,
>  						   work.work);
> -	int backoff = 0;
> -
> -more:
> -	if (test_and_set_bit(BUSY, &con->state) != 0) {
> -		dout("con_work %p BUSY already set\n", con);
> -		goto out;
> -	}
> -	dout("con_work %p start, clearing QUEUED\n", con);
> -	clear_bit(QUEUED, &con->state);
>  
>  	mutex_lock(&con->mutex);
>  
> @@ -1994,28 +1967,13 @@ more:
>  	    try_read(con) < 0 ||
>  	    try_write(con) < 0) {
>  		mutex_unlock(&con->mutex);
> -		backoff = 1;
>  		ceph_fault(con);     /* error/fault path */
>  		goto done_unlocked;
>  	}
>  
>  done:
>  	mutex_unlock(&con->mutex);
> -
>  done_unlocked:
> -	clear_bit(BUSY, &con->state);
> -	dout("con->state=%lu\n", con->state);
> -	if (test_bit(QUEUED, &con->state)) {
> -		if (!backoff || test_bit(OPENING, &con->state)) {
> -			dout("con_work %p QUEUED reset, looping\n", con);
> -			goto more;
> -		}
> -		dout("con_work %p QUEUED reset, but just faulted\n", con);
> -		clear_bit(QUEUED, &con->state);
> -	}
> -	dout("con_work %p done\n", con);
> -
> -out:
>  	con->ops->put(con);
>  }
>  
> -- 
> 1.7.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 22/32] ceph: fsc->*_wq's aren't used in memory reclaim path
  2011-01-03 13:49 ` [PATCH 22/32] ceph: fsc->*_wq's aren't " Tejun Heo
@ 2011-01-03 17:58   ` Sage Weil
  0 siblings, 0 replies; 119+ messages in thread
From: Sage Weil @ 2011-01-03 17:58 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-kernel, ceph-devel

On Mon, 3 Jan 2011, Tejun Heo wrote:
> fsc->*_wq's aren't depended upon during memory reclaim.  Convert to
> alloc_workqueue() w/o WQ_MEM_RECLAIM.
> 
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: Sage Weil <sage@newdream.net>
> Cc: ceph-devel@vger.kernel.org
> ---
> Only compile tested.  Please feel free to take it into the subsystem
> tree or simply ack - I'll route it through the wq tree.

I'll take this one through the ceph tree as well.

Thanks!
sage


> 
> Thanks.
> 
>  fs/ceph/super.c |   10 +++++++---
>  1 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/ceph/super.c b/fs/ceph/super.c
> index 08b460a..1f6436e 100644
> --- a/fs/ceph/super.c
> +++ b/fs/ceph/super.c
> @@ -443,13 +443,17 @@ struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt,
>  		goto fail_client;
>  
>  	err = -ENOMEM;
> -	fsc->wb_wq = create_workqueue("ceph-writeback");
> +	/*
> +	 * The number of concurrent works can be high but they don't need
> +	 * to be processed in parallel, limit concurrency.
> +	 */
> +	fsc->wb_wq = alloc_workqueue("ceph-writeback", 0, 1);
>  	if (fsc->wb_wq == NULL)
>  		goto fail_bdi;
> -	fsc->pg_inv_wq = create_singlethread_workqueue("ceph-pg-invalid");
> +	fsc->pg_inv_wq = alloc_workqueue("ceph-pg-invalid", 0, 1);
>  	if (fsc->pg_inv_wq == NULL)
>  		goto fail_wb_wq;
> -	fsc->trunc_wq = create_singlethread_workqueue("ceph-trunc");
> +	fsc->trunc_wq = alloc_workqueue("ceph-trunc", 0, 1);
>  	if (fsc->trunc_wq == NULL)
>  		goto fail_pg_inv_wq;
>  
> -- 
> 1.7.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 20/32] video/msm_fb: use system_wq instead of dedicated workqueues
  2011-01-03 17:06       ` Stanislaw Gruszka
@ 2011-01-03 18:10           ` Daniel Walker
  -1 siblings, 0 replies; 119+ messages in thread
From: Daniel Walker @ 2011-01-03 18:10 UTC (permalink / raw)
  To: Stanislaw Gruszka
  Cc: Tejun Heo, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	Stanislaw Gruszka, linux-usb-u79uwXL29TY76Z2rM5mHXA, David Brown,
	Bryan Huntsman, linux-arm-msm-u79uwXL29TY76Z2rM5mHXA

On Mon, 2011-01-03 at 18:06 +0100, Stanislaw Gruszka wrote:
> On Mon, Jan 03, 2011 at 02:49:43PM +0100, Tejun Heo wrote:
> > With cmwq, there's no reason to use separate workqueues.  Drop
> > msmfb_info->resume_workqueue and use system_wq instead.
> > 
> > Signed-off-by: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> > Cc: Stanislaw Gruszka <stf_xl-5tc4TXWwyLM@public.gmane.org>
> I'm not the right person, CC according to MAINTAINERS

ARM/QUALCOMM MSM MACHINE SUPPORT
M:      David Brown <davidb-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
M:      Daniel Walker <dwalker-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
M:      Bryan Huntsman <bryanh-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
L:      linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
F:      arch/arm/mach-msm/
F:      drivers/video/msm/
F:      drivers/mmc/host/msm_sdcc.c
F:      drivers/mmc/host/msm_sdcc.h
F:      drivers/serial/msm_serial.h
F:      drivers/serial/msm_serial.c
T:      git git://codeaurora.org/quic/kernel/davidb/linux-msm.git
S:      Maintained



-- 

Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 20/32] video/msm_fb: use system_wq instead of dedicated workqueues
@ 2011-01-03 18:10           ` Daniel Walker
  0 siblings, 0 replies; 119+ messages in thread
From: Daniel Walker @ 2011-01-03 18:10 UTC (permalink / raw)
  To: Stanislaw Gruszka
  Cc: Tejun Heo, linux-kernel, Stanislaw Gruszka, linux-usb,
	David Brown, Bryan Huntsman, linux-arm-msm

On Mon, 2011-01-03 at 18:06 +0100, Stanislaw Gruszka wrote:
> On Mon, Jan 03, 2011 at 02:49:43PM +0100, Tejun Heo wrote:
> > With cmwq, there's no reason to use separate workqueues.  Drop
> > msmfb_info->resume_workqueue and use system_wq instead.
> > 
> > Signed-off-by: Tejun Heo <tj@kernel.org>
> > Cc: Stanislaw Gruszka <stf_xl@wp.pl>
> I'm not the right person, CC according to MAINTAINERS

ARM/QUALCOMM MSM MACHINE SUPPORT
M:      David Brown <davidb@codeaurora.org>
M:      Daniel Walker <dwalker@codeaurora.org>
M:      Bryan Huntsman <bryanh@codeaurora.org>
L:      linux-arm-msm@vger.kernel.org
F:      arch/arm/mach-msm/
F:      drivers/video/msm/
F:      drivers/mmc/host/msm_sdcc.c
F:      drivers/mmc/host/msm_sdcc.h
F:      drivers/serial/msm_serial.h
F:      drivers/serial/msm_serial.c
T:      git git://codeaurora.org/quic/kernel/davidb/linux-msm.git
S:      Maintained



-- 

Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.


^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 01/32] arm/omap: use system_wq in mailbox
  2011-01-03 13:49 ` [PATCH 01/32] arm/omap: use system_wq in mailbox Tejun Heo
@ 2011-01-03 21:35   ` Kanigeri, Hari
  2011-01-04  5:24     ` Tejun Heo
  0 siblings, 1 reply; 119+ messages in thread
From: Kanigeri, Hari @ 2011-01-03 21:35 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-kernel, Tony Lindgren, linux-omap

Tejun,

On Mon, Jan 3, 2011 at 7:49 AM, Tejun Heo <tj@kernel.org> wrote:
> With cmwq, there's no reason to use a separate workqueue for mailbox.
> Use the system_wq instead.  mbox->rxq->work is sync flushed in
> omap_mbox_fini() to make sure it's not running on any cpu, which makes
> sure that no mbox work is running when omap_mbox_exit() is entered.
>
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: Tony Lindgren <tony@atomide.com>
> Cc: linux-omap@vger.kernel.org
> ---
> Only compile tested.  Please feel free to take it into the subsystem
> tree or simply ack - I'll route it through the wq tree.

This was changed to dedicated work queue because of performance issues
when there is heavy mailbox traffic between the cores.

Reference:
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg24240.html


>
> Thanks.
>
>  arch/arm/plat-omap/mailbox.c |   10 ++--------
>  1 files changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
> index d2fafb8..5bc4d7b 100644
> --- a/arch/arm/plat-omap/mailbox.c
> +++ b/arch/arm/plat-omap/mailbox.c
> @@ -31,7 +31,6 @@
>
>  #include <plat/mailbox.h>
>
> -static struct workqueue_struct *mboxd;
>  static struct omap_mbox **mboxes;
>  static bool rq_full;
>
> @@ -186,7 +185,7 @@ static void __mbox_rx_interrupt(struct omap_mbox *mbox)
>        /* no more messages in the fifo. clear IRQ source. */
>        ack_mbox_irq(mbox, IRQ_RX);
>  nomem:
> -       queue_work(mboxd, &mbox->rxq->work);
> +       schedule_work(&mbox->rxq->work);
>  }
>
>  static irqreturn_t mbox_interrupt(int irq, void *p)
> @@ -291,7 +290,7 @@ static void omap_mbox_fini(struct omap_mbox *mbox)
>  {
>        free_irq(mbox->irq, mbox);
>        tasklet_kill(&mbox->txq->tasklet);
> -       flush_work(&mbox->rxq->work);
> +       flush_work_sync(&mbox->rxq->work);
>        mbox_queue_free(mbox->txq);
>        mbox_queue_free(mbox->rxq);
>
> @@ -385,10 +384,6 @@ static int __init omap_mbox_init(void)
>        if (err)
>                return err;
>
> -       mboxd = create_workqueue("mboxd");
> -       if (!mboxd)
> -               return -ENOMEM;
> -
>        /* kfifo size sanity check: alignment and minimal size */
>        mbox_kfifo_size = ALIGN(mbox_kfifo_size, sizeof(mbox_msg_t));
>        mbox_kfifo_size = max_t(unsigned int, mbox_kfifo_size, sizeof(mbox_msg_t));
> @@ -399,7 +394,6 @@ subsys_initcall(omap_mbox_init);
>
>  static void __exit omap_mbox_exit(void)
>  {
> -       destroy_workqueue(mboxd);
>        class_unregister(&omap_mbox_class);
>  }
>  module_exit(omap_mbox_exit);
> --
> 1.7.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>



-- 
Thank you,
Best regards,
Hari Kanigeri

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 11/32] v4l/cx18: update workqueue usage
  2011-01-03 13:49 ` [PATCH 11/32] v4l/cx18: update workqueue usage Tejun Heo
@ 2011-01-04  0:54   ` Andy Walls
  2011-01-04  8:36     ` Tejun Heo
  2011-01-08 17:03   ` Andy Walls
  1 sibling, 1 reply; 119+ messages in thread
From: Andy Walls @ 2011-01-04  0:54 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-kernel, linux-media

On Mon, 2011-01-03 at 14:49 +0100, Tejun Heo wrote:
> With cmwq, there's no reason to use separate out_work_queue.  Drop it
> and use system_wq instead.  The in_work_queue needs to be ordered so
> can't use one of the system wqs; however, as it isn't used to reclaim
> memory, allocate the workqueue with alloc_ordered_workqueue() without
> WQ_MEM_RECLAIM.
> 
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: Andy Walls <awalls@md.metrocast.net>
> Cc: linux-media@vger.kernel.org

Tejun,

I have a question about cmwq, but to ask it, I need to give the context.

The non-system out_work_queue in cx18 had two purposes:

1. To prevent a userspace video rendering application from sleeping in
read(), when it had emptied a cx18 driver DMA buffer and the cx18 driver
had to sleep to notify the CX2318 engine that the buffer was available
again.

Your change has no adverse effect on this.


2. To prevent work items being handled by keventd/n from being delayed
too long, as the deferred work in question can involve a bit of sleeping
due to contention, the workload of the CX23418's MPEG encoding engine,
and the number of CX23418 devices in the system.

Will all the sleeping that can happen, is the move to a system wq, under
cmwq, going to have adverse affects on processing other work items in
the system?

I get the feeling it won't be a problem with cmwq, but I haven't paid
enough attention to be sure. 

Here are some gory details, if it helps:

A single CX23418 has *one* cx18 driver to CX23418 Capture Processing
Unit (epu2cpu_mb) mailbox though which the cx18 driver sends all normal
commands along with a notification interrupt to the CX23418.

The CX23418 will acknowledge all commands with ack back in the mailbox
and an interrupt for the cx18 driver.  Sometimes the ack happens right
away.  Sometimes the cx18 driver has to wait(), if the CX23418 is
busy.  

The cx18 driver uses a mutex (epu2cpu_mb_lock) to protect cx18 driver
access to the one epu2cpu_mb mailbox.  The mutex is grabbed and released
on a per epu2cpu_mb mailbox command basis

To tell the CX23418 about a usable empty buffer for DMA, one epu2cpu
mailbox command (CX18_CPU_DE_SET_MDL) must be performed for each usable
empty buffer.

A CX23418 can support multiple, simultaneous logical capture streams at
once.  The streams for a DVB TS, analog video converted to MPEG, VBI
data, and the MPEG Index data are common to have active simultaneously.

The CX23418 can keep track of 63 empty buffers for each active stream
and the cx18 driver tries to ensure the CX23418 always has as close to
63 as possible available at any time.

The out_work_handler, when triggered for a capture stream type, will try
to perform, as needed, from 1 to 63 CX18_CPU_DE_SET_MDL mailbox commands
for that stream.  At steady state, the number of CX18_CPU_DE_SET_MDL
mailbox commands executed one after the other in a batch will likely be
from 1 to 3.

It is not unusual for a non-commercial end user to have 2 or 3 CX23418
based capture cards in one machine.  I am aware of at least one
commercial user that had 5 CX23418 based cards in a modest machine.

It is not unusual for scheduled TV recording software to start nearly
simultaneous DTV TS, MPEG, and VBI or MPEG Index streams on multiple
cards.  So 3 CX23418 cards with 3 streams each.   Let's nominally
estimate the timing of the CX18_CPU_DE_SET_MDL commands per stream at
the PAL frame rate of 25 Hz; or 1 CX18_CPU_DE_SET_MDL mailbox command
per stream per 40 milliseconds.

Regards,
Andy

> ---
> Only compile tested.  Please feel free to take it into the subsystem
> tree or simply ack - I'll route it through the wq tree.
> 
> Thanks.
> 
>  drivers/media/video/cx18/cx18-driver.c  |   24 ++----------------------
>  drivers/media/video/cx18/cx18-driver.h  |    3 ---
>  drivers/media/video/cx18/cx18-streams.h |    3 +--
>  3 files changed, 3 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/media/video/cx18/cx18-driver.c b/drivers/media/video/cx18/cx18-driver.c
> index df60f27..41c0822 100644
> --- a/drivers/media/video/cx18/cx18-driver.c
> +++ b/drivers/media/video/cx18/cx18-driver.c
> @@ -656,7 +656,7 @@ static int __devinit cx18_create_in_workq(struct cx18 *cx)
>  {
>  	snprintf(cx->in_workq_name, sizeof(cx->in_workq_name), "%s-in",
>  		 cx->v4l2_dev.name);
> -	cx->in_work_queue = create_singlethread_workqueue(cx->in_workq_name);
> +	cx->in_work_queue = alloc_ordered_workqueue(cx->in_workq_name, 0);
>  	if (cx->in_work_queue == NULL) {
>  		CX18_ERR("Unable to create incoming mailbox handler thread\n");
>  		return -ENOMEM;
> @@ -664,18 +664,6 @@ static int __devinit cx18_create_in_workq(struct cx18 *cx)
>  	return 0;
>  }
>  
> -static int __devinit cx18_create_out_workq(struct cx18 *cx)
> -{
> -	snprintf(cx->out_workq_name, sizeof(cx->out_workq_name), "%s-out",
> -		 cx->v4l2_dev.name);
> -	cx->out_work_queue = create_workqueue(cx->out_workq_name);
> -	if (cx->out_work_queue == NULL) {
> -		CX18_ERR("Unable to create outgoing mailbox handler threads\n");
> -		return -ENOMEM;
> -	}
> -	return 0;
> -}
> -
>  static void __devinit cx18_init_in_work_orders(struct cx18 *cx)
>  {
>  	int i;
> @@ -702,15 +690,9 @@ static int __devinit cx18_init_struct1(struct cx18 *cx)
>  	mutex_init(&cx->epu2apu_mb_lock);
>  	mutex_init(&cx->epu2cpu_mb_lock);
>  
> -	ret = cx18_create_out_workq(cx);
> -	if (ret)
> -		return ret;
> -
>  	ret = cx18_create_in_workq(cx);
> -	if (ret) {
> -		destroy_workqueue(cx->out_work_queue);
> +	if (ret)
>  		return ret;
> -	}
>  
>  	cx18_init_in_work_orders(cx);
>  
> @@ -1094,7 +1076,6 @@ free_mem:
>  	release_mem_region(cx->base_addr, CX18_MEM_SIZE);
>  free_workqueues:
>  	destroy_workqueue(cx->in_work_queue);
> -	destroy_workqueue(cx->out_work_queue);
>  err:
>  	if (retval == 0)
>  		retval = -ENODEV;
> @@ -1244,7 +1225,6 @@ static void cx18_remove(struct pci_dev *pci_dev)
>  	cx18_halt_firmware(cx);
>  
>  	destroy_workqueue(cx->in_work_queue);
> -	destroy_workqueue(cx->out_work_queue);
>  
>  	cx18_streams_cleanup(cx, 1);
>  
> diff --git a/drivers/media/video/cx18/cx18-driver.h b/drivers/media/video/cx18/cx18-driver.h
> index 77be58c..f7f71d1 100644
> --- a/drivers/media/video/cx18/cx18-driver.h
> +++ b/drivers/media/video/cx18/cx18-driver.h
> @@ -614,9 +614,6 @@ struct cx18 {
>  	struct cx18_in_work_order in_work_order[CX18_MAX_IN_WORK_ORDERS];
>  	char epu_debug_str[256]; /* CX18_EPU_DEBUG is rare: use shared space */
>  
> -	struct workqueue_struct *out_work_queue;
> -	char out_workq_name[12]; /* "cx18-NN-out" */
> -
>  	/* i2c */
>  	struct i2c_adapter i2c_adap[2];
>  	struct i2c_algo_bit_data i2c_algo[2];
> diff --git a/drivers/media/video/cx18/cx18-streams.h b/drivers/media/video/cx18/cx18-streams.h
> index 77412be..5837ffb 100644
> --- a/drivers/media/video/cx18/cx18-streams.h
> +++ b/drivers/media/video/cx18/cx18-streams.h
> @@ -41,8 +41,7 @@ static inline bool cx18_stream_enabled(struct cx18_stream *s)
>  /* Related to submission of mdls to firmware */
>  static inline void cx18_stream_load_fw_queue(struct cx18_stream *s)
>  {
> -	struct cx18 *cx = s->cx;
> -	queue_work(cx->out_work_queue, &s->out_work_order);
> +	schedule_work(&s->out_work_order);
>  }
>  
>  static inline void cx18_stream_put_mdl_fw(struct cx18_stream *s,



^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 05/32] crypto: mark crypto workqueues CPU_INTENSIVE
  2011-01-03 13:49   ` Tejun Heo
@ 2011-01-04  4:38     ` Herbert Xu
  -1 siblings, 0 replies; 119+ messages in thread
From: Herbert Xu @ 2011-01-04  4:38 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-kernel, David S. Miller, linux-crypto

On Mon, Jan 03, 2011 at 02:49:28PM +0100, Tejun Heo wrote:
> kcrypto_wq and pcrypt->wq's are used to run ciphers and may consume
> considerable amount of CPU cycles.  Mark both as CPU_INTENSIVE so that
> they don't block other work items.
> 
> As the workqueues are primarily used to burn CPU cycles, concurrency
> levels shouldn't matter much and are left at 1.  A higher value may be
> beneficial and needs investigation.
> 
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: Herbert Xu <herbert@gondor.apana.org.au>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: linux-crypto@vger.kernel.org

Patch applied.  Thanks!
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 05/32] crypto: mark crypto workqueues CPU_INTENSIVE
@ 2011-01-04  4:38     ` Herbert Xu
  0 siblings, 0 replies; 119+ messages in thread
From: Herbert Xu @ 2011-01-04  4:38 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-kernel, David S. Miller, linux-crypto

On Mon, Jan 03, 2011 at 02:49:28PM +0100, Tejun Heo wrote:
> kcrypto_wq and pcrypt->wq's are used to run ciphers and may consume
> considerable amount of CPU cycles.  Mark both as CPU_INTENSIVE so that
> they don't block other work items.
> 
> As the workqueues are primarily used to burn CPU cycles, concurrency
> levels shouldn't matter much and are left at 1.  A higher value may be
> beneficial and needs investigation.
> 
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: Herbert Xu <herbert@gondor.apana.org.au>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: linux-crypto@vger.kernel.org

Patch applied.  Thanks!
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 17/32] scsi/ibmvstgt: use system_wq instead of vtgtd workqueue
  2011-01-03 17:45   ` Bart Van Assche
@ 2011-01-04  5:20     ` Tejun Heo
  0 siblings, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-04  5:20 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: linux-kernel, FUJITA Tomonori, James E.J. Bottomley, linux-scsi

Hello,

On Mon, Jan 03, 2011 at 06:45:33PM +0100, Bart Van Assche wrote:
> No matter which storage target will go upstream, I'm afraid that this
> patch will conflict with it. See e.g.
> http://dchs.spinics.net/lists/linux-scsi/msg49105.html.

Ah, okay.  The full conversion is gonna span several devel cycles
anyway.  I'll re-convert ibmvstgt when the dust settles down.

Thank you.

--
tejun

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 01/32] arm/omap: use system_wq in mailbox
  2011-01-03 21:35   ` Kanigeri, Hari
@ 2011-01-04  5:24     ` Tejun Heo
  2011-01-25 13:47       ` Tejun Heo
  0 siblings, 1 reply; 119+ messages in thread
From: Tejun Heo @ 2011-01-04  5:24 UTC (permalink / raw)
  To: Kanigeri, Hari; +Cc: linux-kernel, Tony Lindgren, linux-omap

Hello,

On Mon, Jan 03, 2011 at 03:35:45PM -0600, Kanigeri, Hari wrote:
> This was changed to dedicated work queue because of performance issues
> when there is heavy mailbox traffic between the cores.
> 
> Reference:
> http://www.mail-archive.com/linux-omap@vger.kernel.org/msg24240.html

Using dedicated workqueue or system_wq doesn't make any difference in
terms of execution latency anymore.  Sleeping work items no longer
delay execution of other work items.  If mailbox is very latency
sensitive, it might make sense to create a HIGHPRI workqueue but that
usually isn't necessary.

Thank you.

--
tejun

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 11/32] v4l/cx18: update workqueue usage
  2011-01-04  0:54   ` Andy Walls
@ 2011-01-04  8:36     ` Tejun Heo
  2011-01-04 13:21       ` Andy Walls
  0 siblings, 1 reply; 119+ messages in thread
From: Tejun Heo @ 2011-01-04  8:36 UTC (permalink / raw)
  To: Andy Walls; +Cc: linux-kernel, linux-media

Hello,

On Mon, Jan 03, 2011 at 07:54:56PM -0500, Andy Walls wrote:
> 2. To prevent work items being handled by keventd/n from being delayed
> too long, as the deferred work in question can involve a bit of sleeping
> due to contention, the workload of the CX23418's MPEG encoding engine,
> and the number of CX23418 devices in the system.
> 
> Will all the sleeping that can happen, is the move to a system wq, under
> cmwq, going to have adverse affects on processing other work items in
> the system?
> 
> I get the feeling it won't be a problem with cmwq, but I haven't paid
> enough attention to be sure. 

It won't be a problem.  Now the system_wq supports parallel execution
of multiple works and manages concurrency automatically.  Work items
can sleep as necessary without worrying about other work items.

...
> It is not unusual for scheduled TV recording software to start nearly
> simultaneous DTV TS, MPEG, and VBI or MPEG Index streams on multiple
> cards.  So 3 CX23418 cards with 3 streams each.   Let's nominally
> estimate the timing of the CX18_CPU_DE_SET_MDL commands per stream at
> the PAL frame rate of 25 Hz; or 1 CX18_CPU_DE_SET_MDL mailbox command
> per stream per 40 milliseconds.

IIUC, if they spend any significant amount of time executing, they'll
be doing so by waiting for events (mutex, IRQ...), right?  If so,
there's nothing to worry about.  If it's gonna burn a lot of CPU
cycles, we'll need to use a workqueue marked CPU_INTENSIVE but I don't
think that's the case here.

Thank you.

-- 
tejun

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 11/32] v4l/cx18: update workqueue usage
  2011-01-04  8:36     ` Tejun Heo
@ 2011-01-04 13:21       ` Andy Walls
  0 siblings, 0 replies; 119+ messages in thread
From: Andy Walls @ 2011-01-04 13:21 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-kernel, linux-media

On Tue, 2011-01-04 at 09:36 +0100, Tejun Heo wrote:
> Hello,
> 
> On Mon, Jan 03, 2011 at 07:54:56PM -0500, Andy Walls wrote:
> > 2. To prevent work items being handled by keventd/n from being delayed
> > too long, as the deferred work in question can involve a bit of sleeping
> > due to contention, the workload of the CX23418's MPEG encoding engine,
> > and the number of CX23418 devices in the system.
> > 
> > Will all the sleeping that can happen, is the move to a system wq, under
> > cmwq, going to have adverse affects on processing other work items in
> > the system?
> > 
> > I get the feeling it won't be a problem with cmwq, but I haven't paid
> > enough attention to be sure. 
> 
> It won't be a problem.  Now the system_wq supports parallel execution
> of multiple works and manages concurrency automatically.  Work items
> can sleep as necessary without worrying about other work items.

OK, that's what I thought.  I just wanted to ensure that busy CX23418
chips are not going to delay the processing of other work-events in the
rest the system down. 

> ...
> > It is not unusual for scheduled TV recording software to start nearly
> > simultaneous DTV TS, MPEG, and VBI or MPEG Index streams on multiple
> > cards.  So 3 CX23418 cards with 3 streams each.   Let's nominally
> > estimate the timing of the CX18_CPU_DE_SET_MDL commands per stream at
> > the PAL frame rate of 25 Hz; or 1 CX18_CPU_DE_SET_MDL mailbox command
> > per stream per 40 milliseconds.
> 
> IIUC, if they spend any significant amount of time executing, they'll
> be doing so by waiting for events (mutex, IRQ...), right?

Right.  As a CX23418 is expected to do more streaming by the host, the
mailbox mutex contention goes up and the latency of the CX23418
responding to mailbox commands also goes up so there is more wait()ing.


>   If so,
> there's nothing to worry about.  If it's gonna burn a lot of CPU
> cycles, we'll need to use a workqueue marked CPU_INTENSIVE but I don't
> think that's the case here.

Correct, CPU is not the concern here.


> Thank you.

Thanks.  I'll do a proper inspection of the patch tonight.  It looked OK
on cursory review.

Regards,
Andy


^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 21/32] fs/aio: aio_wq isn't used in memory reclaim path
  2011-01-03 13:49 ` [PATCH 21/32] fs/aio: aio_wq isn't used in memory reclaim path Tejun Heo
@ 2011-01-04 15:56   ` Jeff Moyer
  2011-01-05 11:28     ` Tejun Heo
  2011-01-26 11:21   ` [PATCH UPDATED " Tejun Heo
  1 sibling, 1 reply; 119+ messages in thread
From: Jeff Moyer @ 2011-01-04 15:56 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-kernel, Benjamin LaHaise, linux-aio

Tejun Heo <tj@kernel.org> writes:

> aio_wq isn't used during memory reclaim.  Convert to alloc_workqueue()
> without WQ_MEM_RECLAIM.  It's possible to use system_wq but given that
> the number of work items is determined from userland and the work item
> may block, enforcing strict concurrency limit would be a good idea.

I would think that just given that it may block would be enough to keep
it off of the system workqueue.

> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: Benjamin LaHaise <bcrl@kvack.org>
> Cc: linux-aio@kvack.org
> ---
> Please feel free to take it into the subsystem tree or simply ack -
> I'll route it through the wq tree.
>
> Thanks.
>
>  fs/aio.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/aio.c b/fs/aio.c
> index 8c8f6c5..dc3fcbb 100644
> --- a/fs/aio.c
> +++ b/fs/aio.c
> @@ -85,7 +85,7 @@ static int __init aio_setup(void)
>  	kiocb_cachep = KMEM_CACHE(kiocb, SLAB_HWCACHE_ALIGN|SLAB_PANIC);
>  	kioctx_cachep = KMEM_CACHE(kioctx,SLAB_HWCACHE_ALIGN|SLAB_PANIC);
>  
> -	aio_wq = create_workqueue("aio");
> +	aio_wq = alloc_workqueue("aio", 0, 1);	/* used to limit concurrency */

OK, the only difference here is the removal of the WQ_MEM_RECLAIM flag,
as you noted.

>  	abe_pool = mempool_create_kmalloc_pool(1, sizeof(struct aio_batch_entry));
>  	BUG_ON(!abe_pool);
>  
> @@ -569,7 +569,7 @@ static int __aio_put_req(struct kioctx *ctx, struct kiocb *req)
>  		spin_lock(&fput_lock);
>  		list_add(&req->ki_list, &fput_head);
>  		spin_unlock(&fput_lock);
> -		queue_work(aio_wq, &fput_work);
> +		schedule_work(&fput_work);

I'm not sure where this change fits into the patch description.  Why did
you do this?

Cheers,
Jeff

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 09/32] drm/radeon: use system_wq instead of dev_priv->wq
  2011-01-03 13:49   ` Tejun Heo
  (?)
@ 2011-01-05  0:21   ` Alex Deucher
  2011-01-06  4:31     ` Dave Airlie
  -1 siblings, 1 reply; 119+ messages in thread
From: Alex Deucher @ 2011-01-05  0:21 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-kernel, dri-devel

On Mon, Jan 3, 2011 at 8:49 AM, Tejun Heo <tj@kernel.org> wrote:
> With cmwq, there's no reason for radeon to use a dedicated workqueue.
> Drop dev_priv->wq and use system_wq instead.
>
> Because radeon_driver_irq_uninstall_kms() may be called from
> unsleepable context, the work items can't be flushed from there.
> Instead, init and flush from radeon_irq_kms_init/fini().
>
> While at it, simplify canceling/flushing of rdev->pm.dynpm_idle_work.
> Always initialize and sync cancel instead of being unnecessarily smart
> about it.
>
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: David Airlie <airlied@linux.ie>
> Cc: dri-devel@lists.freedesktop.org
> ---
> Only compile tested.  Please feel free to take it into the subsystem
> tree or simply ack - I'll route it through the wq tree.

Patch looks good to me.  I'm not sure what's the best way to send this
upstream.  I'm working on some irq changes in the same area now, so
I'd prefer if we pushed it through Dave's tree, but I can handle it
either way.

Acked-by: Alex Deucher <alexdeucher@gmail.com>

Alex

>
> Thanks.
>
>  drivers/gpu/drm/radeon/evergreen.c      |    2 +-
>  drivers/gpu/drm/radeon/r100.c           |    2 +-
>  drivers/gpu/drm/radeon/r600.c           |    2 +-
>  drivers/gpu/drm/radeon/radeon.h         |    1 -
>  drivers/gpu/drm/radeon/radeon_device.c  |    6 ----
>  drivers/gpu/drm/radeon/radeon_irq_kms.c |    5 ++-
>  drivers/gpu/drm/radeon/radeon_pm.c      |   47 ++++++++++--------------------
>  drivers/gpu/drm/radeon/rs600.c          |    2 +-
>  8 files changed, 23 insertions(+), 44 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
> index 7b337c3..6540adb 100644
> --- a/drivers/gpu/drm/radeon/evergreen.c
> +++ b/drivers/gpu/drm/radeon/evergreen.c
> @@ -2516,7 +2516,7 @@ restart_ih:
>        if (wptr != rdev->ih.wptr)
>                goto restart_ih;
>        if (queue_hotplug)
> -               queue_work(rdev->wq, &rdev->hotplug_work);
> +               schedule_work(&rdev->hotplug_work);
>        rdev->ih.rptr = rptr;
>        WREG32(IH_RB_RPTR, rdev->ih.rptr);
>        spin_unlock_irqrestore(&rdev->ih.lock, flags);
> diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
> index 8e10aa9..1d15748 100644
> --- a/drivers/gpu/drm/radeon/r100.c
> +++ b/drivers/gpu/drm/radeon/r100.c
> @@ -622,7 +622,7 @@ int r100_irq_process(struct radeon_device *rdev)
>        /* reset gui idle ack.  the status bit is broken */
>        rdev->irq.gui_idle_acked = false;
>        if (queue_hotplug)
> -               queue_work(rdev->wq, &rdev->hotplug_work);
> +               schedule_work(&rdev->hotplug_work);
>        if (rdev->msi_enabled) {
>                switch (rdev->family) {
>                case CHIP_RS400:
> diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
> index 9c92db7..f927cd4 100644
> --- a/drivers/gpu/drm/radeon/r600.c
> +++ b/drivers/gpu/drm/radeon/r600.c
> @@ -3419,7 +3419,7 @@ restart_ih:
>        if (wptr != rdev->ih.wptr)
>                goto restart_ih;
>        if (queue_hotplug)
> -               queue_work(rdev->wq, &rdev->hotplug_work);
> +               schedule_work(&rdev->hotplug_work);
>        rdev->ih.rptr = rptr;
>        WREG32(IH_RB_RPTR, rdev->ih.rptr);
>        spin_unlock_irqrestore(&rdev->ih.lock, flags);
> diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
> index 3a70957..ba233a8 100644
> --- a/drivers/gpu/drm/radeon/radeon.h
> +++ b/drivers/gpu/drm/radeon/radeon.h
> @@ -1095,7 +1095,6 @@ struct radeon_device {
>        struct r700_vram_scratch vram_scratch;
>        int msi_enabled; /* msi enabled */
>        struct r600_ih ih; /* r6/700 interrupt ring */
> -       struct workqueue_struct *wq;
>        struct work_struct hotplug_work;
>        int num_crtc; /* number of crtcs */
>        struct mutex dc_hw_i2c_mutex; /* display controller hw i2c mutex */
> diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
> index 501966a..4bc0012 100644
> --- a/drivers/gpu/drm/radeon/radeon_device.c
> +++ b/drivers/gpu/drm/radeon/radeon_device.c
> @@ -704,11 +704,6 @@ int radeon_device_init(struct radeon_device *rdev,
>        init_waitqueue_head(&rdev->irq.vblank_queue);
>        init_waitqueue_head(&rdev->irq.idle_queue);
>
> -       /* setup workqueue */
> -       rdev->wq = create_workqueue("radeon");
> -       if (rdev->wq == NULL)
> -               return -ENOMEM;
> -
>        /* Set asic functions */
>        r = radeon_asic_init(rdev);
>        if (r)
> @@ -806,7 +801,6 @@ void radeon_device_fini(struct radeon_device *rdev)
>        /* evict vram memory */
>        radeon_bo_evict_vram(rdev);
>        radeon_fini(rdev);
> -       destroy_workqueue(rdev->wq);
>        vga_switcheroo_unregister_client(rdev->pdev);
>        vga_client_register(rdev->pdev, NULL, NULL, NULL);
>        if (rdev->rio_mem)
> diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c
> index a108c7e..33b9d21 100644
> --- a/drivers/gpu/drm/radeon/radeon_irq_kms.c
> +++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c
> @@ -64,8 +64,6 @@ void radeon_driver_irq_preinstall_kms(struct drm_device *dev)
>        struct radeon_device *rdev = dev->dev_private;
>        unsigned i;
>
> -       INIT_WORK(&rdev->hotplug_work, radeon_hotplug_work_func);
> -
>        /* Disable *all* interrupts */
>        rdev->irq.sw_int = false;
>        rdev->irq.gui_idle = false;
> @@ -110,6 +108,8 @@ int radeon_irq_kms_init(struct radeon_device *rdev)
>  {
>        int r = 0;
>
> +       INIT_WORK(&rdev->hotplug_work, radeon_hotplug_work_func);
> +
>        spin_lock_init(&rdev->irq.sw_lock);
>        r = drm_vblank_init(rdev->ddev, rdev->num_crtc);
>        if (r) {
> @@ -148,6 +148,7 @@ void radeon_irq_kms_fini(struct radeon_device *rdev)
>                if (rdev->msi_enabled)
>                        pci_disable_msi(rdev->pdev);
>        }
> +       flush_work_sync(&rdev->hotplug_work);
>  }
>
>  void radeon_irq_kms_sw_irq_get(struct radeon_device *rdev)
> diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
> index 8c9b2ef..845f295 100644
> --- a/drivers/gpu/drm/radeon/radeon_pm.c
> +++ b/drivers/gpu/drm/radeon/radeon_pm.c
> @@ -405,20 +405,13 @@ static ssize_t radeon_set_pm_method(struct device *dev,
>                rdev->pm.dynpm_planned_action = DYNPM_ACTION_DEFAULT;
>                mutex_unlock(&rdev->pm.mutex);
>        } else if (strncmp("profile", buf, strlen("profile")) == 0) {
> -               bool flush_wq = false;
> -
>                mutex_lock(&rdev->pm.mutex);
> -               if (rdev->pm.pm_method == PM_METHOD_DYNPM) {
> -                       cancel_delayed_work(&rdev->pm.dynpm_idle_work);
> -                       flush_wq = true;
> -               }
>                /* disable dynpm */
>                rdev->pm.dynpm_state = DYNPM_STATE_DISABLED;
>                rdev->pm.dynpm_planned_action = DYNPM_ACTION_NONE;
>                rdev->pm.pm_method = PM_METHOD_PROFILE;
>                mutex_unlock(&rdev->pm.mutex);
> -               if (flush_wq)
> -                       flush_workqueue(rdev->wq);
> +               cancel_delayed_work_sync(&rdev->pm.dynpm_idle_work);
>        } else {
>                DRM_ERROR("invalid power method!\n");
>                goto fail;
> @@ -520,18 +513,14 @@ static void radeon_hwmon_fini(struct radeon_device *rdev)
>
>  void radeon_pm_suspend(struct radeon_device *rdev)
>  {
> -       bool flush_wq = false;
> -
>        mutex_lock(&rdev->pm.mutex);
>        if (rdev->pm.pm_method == PM_METHOD_DYNPM) {
> -               cancel_delayed_work(&rdev->pm.dynpm_idle_work);
>                if (rdev->pm.dynpm_state == DYNPM_STATE_ACTIVE)
>                        rdev->pm.dynpm_state = DYNPM_STATE_SUSPENDED;
> -               flush_wq = true;
>        }
>        mutex_unlock(&rdev->pm.mutex);
> -       if (flush_wq)
> -               flush_workqueue(rdev->wq);
> +
> +       cancel_delayed_work_sync(&rdev->pm.dynpm_idle_work);
>  }
>
>  void radeon_pm_resume(struct radeon_device *rdev)
> @@ -546,8 +535,8 @@ void radeon_pm_resume(struct radeon_device *rdev)
>        if (rdev->pm.pm_method == PM_METHOD_DYNPM
>            && rdev->pm.dynpm_state == DYNPM_STATE_SUSPENDED) {
>                rdev->pm.dynpm_state = DYNPM_STATE_ACTIVE;
> -               queue_delayed_work(rdev->wq, &rdev->pm.dynpm_idle_work,
> -                                       msecs_to_jiffies(RADEON_IDLE_LOOP_MS));
> +               schedule_delayed_work(&rdev->pm.dynpm_idle_work,
> +                                     msecs_to_jiffies(RADEON_IDLE_LOOP_MS));
>        }
>        mutex_unlock(&rdev->pm.mutex);
>        radeon_pm_compute_clocks(rdev);
> @@ -581,6 +570,9 @@ int radeon_pm_init(struct radeon_device *rdev)
>        ret = radeon_hwmon_init(rdev);
>        if (ret)
>                return ret;
> +
> +       INIT_DELAYED_WORK(&rdev->pm.dynpm_idle_work, radeon_dynpm_idle_work_handler);
> +
>        if (rdev->pm.num_power_states > 1) {
>                /* where's the best place to put these? */
>                ret = device_create_file(rdev->dev, &dev_attr_power_profile);
> @@ -594,8 +586,6 @@ int radeon_pm_init(struct radeon_device *rdev)
>                rdev->acpi_nb.notifier_call = radeon_acpi_event;
>                register_acpi_notifier(&rdev->acpi_nb);
>  #endif
> -               INIT_DELAYED_WORK(&rdev->pm.dynpm_idle_work, radeon_dynpm_idle_work_handler);
> -
>                if (radeon_debugfs_pm_init(rdev)) {
>                        DRM_ERROR("Failed to register debugfs file for PM!\n");
>                }
> @@ -609,25 +599,20 @@ int radeon_pm_init(struct radeon_device *rdev)
>  void radeon_pm_fini(struct radeon_device *rdev)
>  {
>        if (rdev->pm.num_power_states > 1) {
> -               bool flush_wq = false;
> -
>                mutex_lock(&rdev->pm.mutex);
>                if (rdev->pm.pm_method == PM_METHOD_PROFILE) {
>                        rdev->pm.profile = PM_PROFILE_DEFAULT;
>                        radeon_pm_update_profile(rdev);
>                        radeon_pm_set_clocks(rdev);
>                } else if (rdev->pm.pm_method == PM_METHOD_DYNPM) {
> -                       /* cancel work */
> -                       cancel_delayed_work(&rdev->pm.dynpm_idle_work);
> -                       flush_wq = true;
>                        /* reset default clocks */
>                        rdev->pm.dynpm_state = DYNPM_STATE_DISABLED;
>                        rdev->pm.dynpm_planned_action = DYNPM_ACTION_DEFAULT;
>                        radeon_pm_set_clocks(rdev);
>                }
>                mutex_unlock(&rdev->pm.mutex);
> -               if (flush_wq)
> -                       flush_workqueue(rdev->wq);
> +
> +               cancel_delayed_work_sync(&rdev->pm.dynpm_idle_work);
>
>                device_remove_file(rdev->dev, &dev_attr_power_profile);
>                device_remove_file(rdev->dev, &dev_attr_power_method);
> @@ -686,12 +671,12 @@ void radeon_pm_compute_clocks(struct radeon_device *rdev)
>                                        radeon_pm_get_dynpm_state(rdev);
>                                        radeon_pm_set_clocks(rdev);
>
> -                                       queue_delayed_work(rdev->wq, &rdev->pm.dynpm_idle_work,
> -                                                          msecs_to_jiffies(RADEON_IDLE_LOOP_MS));
> +                                       schedule_delayed_work(&rdev->pm.dynpm_idle_work,
> +                                                             msecs_to_jiffies(RADEON_IDLE_LOOP_MS));
>                                } else if (rdev->pm.dynpm_state == DYNPM_STATE_PAUSED) {
>                                        rdev->pm.dynpm_state = DYNPM_STATE_ACTIVE;
> -                                       queue_delayed_work(rdev->wq, &rdev->pm.dynpm_idle_work,
> -                                                          msecs_to_jiffies(RADEON_IDLE_LOOP_MS));
> +                                       schedule_delayed_work(&rdev->pm.dynpm_idle_work,
> +                                                             msecs_to_jiffies(RADEON_IDLE_LOOP_MS));
>                                        DRM_DEBUG_DRIVER("radeon: dynamic power management activated\n");
>                                }
>                        } else { /* count == 0 */
> @@ -796,8 +781,8 @@ static void radeon_dynpm_idle_work_handler(struct work_struct *work)
>                        radeon_pm_set_clocks(rdev);
>                }
>
> -               queue_delayed_work(rdev->wq, &rdev->pm.dynpm_idle_work,
> -                                       msecs_to_jiffies(RADEON_IDLE_LOOP_MS));
> +               schedule_delayed_work(&rdev->pm.dynpm_idle_work,
> +                                     msecs_to_jiffies(RADEON_IDLE_LOOP_MS));
>        }
>        mutex_unlock(&rdev->pm.mutex);
>        ttm_bo_unlock_delayed_workqueue(&rdev->mman.bdev, resched);
> diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c
> index f1c6e02..2d707d4 100644
> --- a/drivers/gpu/drm/radeon/rs600.c
> +++ b/drivers/gpu/drm/radeon/rs600.c
> @@ -634,7 +634,7 @@ int rs600_irq_process(struct radeon_device *rdev)
>        /* reset gui idle ack.  the status bit is broken */
>        rdev->irq.gui_idle_acked = false;
>        if (queue_hotplug)
> -               queue_work(rdev->wq, &rdev->hotplug_work);
> +               schedule_work(&rdev->hotplug_work);
>        if (rdev->msi_enabled) {
>                switch (rdev->family) {
>                case CHIP_RS600:
> --
> 1.7.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 08/32] drm/nouveau: use system_wq instead of dev_priv->wq
  2011-01-03 13:49   ` Tejun Heo
  (?)
@ 2011-01-05  1:07   ` Ben Skeggs
  2011-01-05  1:16     ` Ben Skeggs
  -1 siblings, 1 reply; 119+ messages in thread
From: Ben Skeggs @ 2011-01-05  1:07 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-kernel, dri-devel

On Mon, 2011-01-03 at 14:49 +0100, Tejun Heo wrote:
> With cmwq, there's no reason for nouveau to use a dedicated workqueue.
> Drop dev_priv->wq and use system_wq instead.
> 
> Because nouveau_irq_uninstall() may be called from unsleepable
> context, the work items can't be flushed from there.  Instead, init
> and flush from nouveau_load/unload().
Ehh, ok, why not!  I'll push this through the nouveau tree, and it'll
get to Dave from there.

Thanks!
Ben.
> 
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: David Airlie <airlied@linux.ie>
> Cc: dri-devel@lists.freedesktop.org
> ---
> Only compile tested.  Please feel free to take it into the subsystem
> tree or simply ack - I'll route it through the wq tree.
> 
> Thanks.
> 
>  drivers/gpu/drm/nouveau/nouveau_drv.h   |    1 -
>  drivers/gpu/drm/nouveau/nouveau_irq.c   |    9 ---------
>  drivers/gpu/drm/nouveau/nouveau_state.c |   19 ++++++++++---------
>  drivers/gpu/drm/nouveau/nv50_display.c  |    4 ++--
>  4 files changed, 12 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h
> index 1c7db64..2ecf875 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_drv.h
> +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
> @@ -580,7 +580,6 @@ struct drm_nouveau_private {
>  
>  	struct nouveau_bo *vga_ram;
>  
> -	struct workqueue_struct *wq;
>  	struct work_struct irq_work;
>  	struct work_struct hpd_work;
>  
> diff --git a/drivers/gpu/drm/nouveau/nouveau_irq.c b/drivers/gpu/drm/nouveau/nouveau_irq.c
> index 7bfd9e6..7d05a06 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_irq.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_irq.c
> @@ -52,17 +52,8 @@ static int nouveau_ratelimit(void)
>  void
>  nouveau_irq_preinstall(struct drm_device *dev)
>  {
> -	struct drm_nouveau_private *dev_priv = dev->dev_private;
> -
>  	/* Master disable */
>  	nv_wr32(dev, NV03_PMC_INTR_EN_0, 0);
> -
> -	if (dev_priv->card_type >= NV_50) {
> -		INIT_WORK(&dev_priv->irq_work, nv50_display_irq_handler_bh);
> -		INIT_WORK(&dev_priv->hpd_work, nv50_display_irq_hotplug_bh);
> -		spin_lock_init(&dev_priv->hpd_state.lock);
> -		INIT_LIST_HEAD(&dev_priv->vbl_waiting);
> -	}
>  }
>  
>  int
> diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c
> index 049f755..2eea6ea 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_state.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_state.c
> @@ -839,17 +839,17 @@ int nouveau_load(struct drm_device *dev, unsigned long flags)
>  	dev->dev_private = dev_priv;
>  	dev_priv->dev = dev;
>  
> +	/* the followings are used only by >= NV_50 */
> +	INIT_WORK(&dev_priv->irq_work, nv50_display_irq_handler_bh);
> +	INIT_WORK(&dev_priv->hpd_work, nv50_display_irq_hotplug_bh);
> +	spin_lock_init(&dev_priv->hpd_state.lock);
> +	INIT_LIST_HEAD(&dev_priv->vbl_waiting);
> +
>  	dev_priv->flags = flags & NOUVEAU_FLAGS;
>  
>  	NV_DEBUG(dev, "vendor: 0x%X device: 0x%X class: 0x%X\n",
>  		 dev->pci_vendor, dev->pci_device, dev->pdev->class);
>  
> -	dev_priv->wq = create_workqueue("nouveau");
> -	if (!dev_priv->wq) {
> -		ret = -EINVAL;
> -		goto err_priv;
> -	}
> -
>  	/* resource 0 is mmio regs */
>  	/* resource 1 is linear FB */
>  	/* resource 2 is RAMIN (mmio regs + 0x1000000) */
> @@ -862,7 +862,7 @@ int nouveau_load(struct drm_device *dev, unsigned long flags)
>  		NV_ERROR(dev, "Unable to initialize the mmio mapping. "
>  			 "Please report your setup to " DRIVER_EMAIL "\n");
>  		ret = -EINVAL;
> -		goto err_wq;
> +		goto err_priv;
>  	}
>  	NV_DEBUG(dev, "regs mapped ok at 0x%llx\n",
>  					(unsigned long long)mmio_start_offs);
> @@ -969,8 +969,6 @@ err_ramin:
>  	iounmap(dev_priv->ramin);
>  err_mmio:
>  	iounmap(dev_priv->mmio);
> -err_wq:
> -	destroy_workqueue(dev_priv->wq);
>  err_priv:
>  	kfree(dev_priv);
>  	dev->dev_private = NULL;
> @@ -992,6 +990,9 @@ int nouveau_unload(struct drm_device *dev)
>  	engine->display.destroy(dev);
>  	nouveau_card_takedown(dev);
>  
> +	flush_work_sync(&dev_priv->irq_work);
> +	flush_work_sync(&dev_priv->hpd_work);
> +
>  	iounmap(dev_priv->mmio);
>  	iounmap(dev_priv->ramin);
>  
> diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
> index f624c61..3d569da 100644
> --- a/drivers/gpu/drm/nouveau/nv50_display.c
> +++ b/drivers/gpu/drm/nouveau/nv50_display.c
> @@ -1110,7 +1110,7 @@ nv50_display_irq_handler(struct drm_device *dev)
>  		dev_priv->hpd_state.hpd1_bits |= hpd1_bits;
>  		spin_unlock(&dev_priv->hpd_state.lock);
>  
> -		queue_work(dev_priv->wq, &dev_priv->hpd_work);
> +		schedule_work(&dev_priv->hpd_work);
>  	}
>  
>  	while (nv_rd32(dev, NV50_PMC_INTR_0) & NV50_PMC_INTR_0_DISPLAY) {
> @@ -1139,7 +1139,7 @@ nv50_display_irq_handler(struct drm_device *dev)
>  		if (clock) {
>  			nv_wr32(dev, NV03_PMC_INTR_EN_0, 0);
>  			if (!work_pending(&dev_priv->irq_work))
> -				queue_work(dev_priv->wq, &dev_priv->irq_work);
> +				schedule_work(&dev_priv->irq_work);
>  			delayed |= clock;
>  			intr1 &= ~clock;
>  		}



^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 08/32] drm/nouveau: use system_wq instead of dev_priv->wq
  2011-01-05  1:07   ` Ben Skeggs
@ 2011-01-05  1:16     ` Ben Skeggs
  2011-01-06 17:29       ` Tejun Heo
  0 siblings, 1 reply; 119+ messages in thread
From: Ben Skeggs @ 2011-01-05  1:16 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-kernel, dri-devel

On Wed, 2011-01-05 at 11:07 +1000, Ben Skeggs wrote:
> On Mon, 2011-01-03 at 14:49 +0100, Tejun Heo wrote:
> > With cmwq, there's no reason for nouveau to use a dedicated workqueue.
> > Drop dev_priv->wq and use system_wq instead.
> > 
> > Because nouveau_irq_uninstall() may be called from unsleepable
> > context, the work items can't be flushed from there.  Instead, init
> > and flush from nouveau_load/unload().
> Ehh, ok, why not!  I'll push this through the nouveau tree, and it'll
> get to Dave from there.
On second thoughts, this won't apply on top of current nouveau code
that's queued for 2.6.38.  Can you rebase on top of Dave's drm-next tree
please.

Ben.

> 
> Thanks!
> Ben.
> > 
> > Signed-off-by: Tejun Heo <tj@kernel.org>
> > Cc: David Airlie <airlied@linux.ie>
> > Cc: dri-devel@lists.freedesktop.org
> > ---
> > Only compile tested.  Please feel free to take it into the subsystem
> > tree or simply ack - I'll route it through the wq tree.
> > 
> > Thanks.
> > 
> >  drivers/gpu/drm/nouveau/nouveau_drv.h   |    1 -
> >  drivers/gpu/drm/nouveau/nouveau_irq.c   |    9 ---------
> >  drivers/gpu/drm/nouveau/nouveau_state.c |   19 ++++++++++---------
> >  drivers/gpu/drm/nouveau/nv50_display.c  |    4 ++--
> >  4 files changed, 12 insertions(+), 21 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h
> > index 1c7db64..2ecf875 100644
> > --- a/drivers/gpu/drm/nouveau/nouveau_drv.h
> > +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
> > @@ -580,7 +580,6 @@ struct drm_nouveau_private {
> >  
> >  	struct nouveau_bo *vga_ram;
> >  
> > -	struct workqueue_struct *wq;
> >  	struct work_struct irq_work;
> >  	struct work_struct hpd_work;
> >  
> > diff --git a/drivers/gpu/drm/nouveau/nouveau_irq.c b/drivers/gpu/drm/nouveau/nouveau_irq.c
> > index 7bfd9e6..7d05a06 100644
> > --- a/drivers/gpu/drm/nouveau/nouveau_irq.c
> > +++ b/drivers/gpu/drm/nouveau/nouveau_irq.c
> > @@ -52,17 +52,8 @@ static int nouveau_ratelimit(void)
> >  void
> >  nouveau_irq_preinstall(struct drm_device *dev)
> >  {
> > -	struct drm_nouveau_private *dev_priv = dev->dev_private;
> > -
> >  	/* Master disable */
> >  	nv_wr32(dev, NV03_PMC_INTR_EN_0, 0);
> > -
> > -	if (dev_priv->card_type >= NV_50) {
> > -		INIT_WORK(&dev_priv->irq_work, nv50_display_irq_handler_bh);
> > -		INIT_WORK(&dev_priv->hpd_work, nv50_display_irq_hotplug_bh);
> > -		spin_lock_init(&dev_priv->hpd_state.lock);
> > -		INIT_LIST_HEAD(&dev_priv->vbl_waiting);
> > -	}
> >  }
> >  
> >  int
> > diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c
> > index 049f755..2eea6ea 100644
> > --- a/drivers/gpu/drm/nouveau/nouveau_state.c
> > +++ b/drivers/gpu/drm/nouveau/nouveau_state.c
> > @@ -839,17 +839,17 @@ int nouveau_load(struct drm_device *dev, unsigned long flags)
> >  	dev->dev_private = dev_priv;
> >  	dev_priv->dev = dev;
> >  
> > +	/* the followings are used only by >= NV_50 */
> > +	INIT_WORK(&dev_priv->irq_work, nv50_display_irq_handler_bh);
> > +	INIT_WORK(&dev_priv->hpd_work, nv50_display_irq_hotplug_bh);
> > +	spin_lock_init(&dev_priv->hpd_state.lock);
> > +	INIT_LIST_HEAD(&dev_priv->vbl_waiting);
> > +
> >  	dev_priv->flags = flags & NOUVEAU_FLAGS;
> >  
> >  	NV_DEBUG(dev, "vendor: 0x%X device: 0x%X class: 0x%X\n",
> >  		 dev->pci_vendor, dev->pci_device, dev->pdev->class);
> >  
> > -	dev_priv->wq = create_workqueue("nouveau");
> > -	if (!dev_priv->wq) {
> > -		ret = -EINVAL;
> > -		goto err_priv;
> > -	}
> > -
> >  	/* resource 0 is mmio regs */
> >  	/* resource 1 is linear FB */
> >  	/* resource 2 is RAMIN (mmio regs + 0x1000000) */
> > @@ -862,7 +862,7 @@ int nouveau_load(struct drm_device *dev, unsigned long flags)
> >  		NV_ERROR(dev, "Unable to initialize the mmio mapping. "
> >  			 "Please report your setup to " DRIVER_EMAIL "\n");
> >  		ret = -EINVAL;
> > -		goto err_wq;
> > +		goto err_priv;
> >  	}
> >  	NV_DEBUG(dev, "regs mapped ok at 0x%llx\n",
> >  					(unsigned long long)mmio_start_offs);
> > @@ -969,8 +969,6 @@ err_ramin:
> >  	iounmap(dev_priv->ramin);
> >  err_mmio:
> >  	iounmap(dev_priv->mmio);
> > -err_wq:
> > -	destroy_workqueue(dev_priv->wq);
> >  err_priv:
> >  	kfree(dev_priv);
> >  	dev->dev_private = NULL;
> > @@ -992,6 +990,9 @@ int nouveau_unload(struct drm_device *dev)
> >  	engine->display.destroy(dev);
> >  	nouveau_card_takedown(dev);
> >  
> > +	flush_work_sync(&dev_priv->irq_work);
> > +	flush_work_sync(&dev_priv->hpd_work);
> > +
> >  	iounmap(dev_priv->mmio);
> >  	iounmap(dev_priv->ramin);
> >  
> > diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
> > index f624c61..3d569da 100644
> > --- a/drivers/gpu/drm/nouveau/nv50_display.c
> > +++ b/drivers/gpu/drm/nouveau/nv50_display.c
> > @@ -1110,7 +1110,7 @@ nv50_display_irq_handler(struct drm_device *dev)
> >  		dev_priv->hpd_state.hpd1_bits |= hpd1_bits;
> >  		spin_unlock(&dev_priv->hpd_state.lock);
> >  
> > -		queue_work(dev_priv->wq, &dev_priv->hpd_work);
> > +		schedule_work(&dev_priv->hpd_work);
> >  	}
> >  
> >  	while (nv_rd32(dev, NV50_PMC_INTR_0) & NV50_PMC_INTR_0_DISPLAY) {
> > @@ -1139,7 +1139,7 @@ nv50_display_irq_handler(struct drm_device *dev)
> >  		if (clock) {
> >  			nv_wr32(dev, NV03_PMC_INTR_EN_0, 0);
> >  			if (!work_pending(&dev_priv->irq_work))
> > -				queue_work(dev_priv->wq, &dev_priv->irq_work);
> > +				schedule_work(&dev_priv->irq_work);
> >  			delayed |= clock;
> >  			intr1 &= ~clock;
> >  		}
> 
> 



^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 21/32] fs/aio: aio_wq isn't used in memory reclaim path
  2011-01-04 15:56   ` Jeff Moyer
@ 2011-01-05 11:28     ` Tejun Heo
  2011-01-05 14:50       ` Jeff Moyer
  0 siblings, 1 reply; 119+ messages in thread
From: Tejun Heo @ 2011-01-05 11:28 UTC (permalink / raw)
  To: Jeff Moyer; +Cc: linux-kernel, Benjamin LaHaise, linux-aio

Hello,

On Tue, Jan 04, 2011 at 10:56:20AM -0500, Jeff Moyer wrote:
> > aio_wq isn't used during memory reclaim.  Convert to alloc_workqueue()
> > without WQ_MEM_RECLAIM.  It's possible to use system_wq but given that
> > the number of work items is determined from userland and the work item
> > may block, enforcing strict concurrency limit would be a good idea.
> 
> I would think that just given that it may block would be enough to keep
> it off of the system workqueue.

Oh, workqueue now can handle parallel execution.  Blocking on system
workqueue is no longer a problem.  One of the main reasons for this
whole series.

> > @@ -85,7 +85,7 @@ static int __init aio_setup(void)
> >  	kiocb_cachep = KMEM_CACHE(kiocb, SLAB_HWCACHE_ALIGN|SLAB_PANIC);
> >  	kioctx_cachep = KMEM_CACHE(kioctx,SLAB_HWCACHE_ALIGN|SLAB_PANIC);
> >  
> > -	aio_wq = create_workqueue("aio");
> > +	aio_wq = alloc_workqueue("aio", 0, 1);	/* used to limit concurrency */
> 
> OK, the only difference here is the removal of the WQ_MEM_RECLAIM flag,
> as you noted.

Yeap.  Do you agree that the concurrency limit is necessary?  If not,
we can just put everything onto system_wq.

> > @@ -569,7 +569,7 @@ static int __aio_put_req(struct kioctx *ctx, struct kiocb *req)
> >  		spin_lock(&fput_lock);
> >  		list_add(&req->ki_list, &fput_head);
> >  		spin_unlock(&fput_lock);
> > -		queue_work(aio_wq, &fput_work);
> > +		schedule_work(&fput_work);
> 
> I'm not sure where this change fits into the patch description.  Why did
> you do this?

Yeah, that's me being forgetful.  Now that aio_wq is solely used to
throttle the max concurrency of aio work items, I thought it would be
better to push fput_work to system workqueue so that it doesn't
interact with aio work items.  I'll update the patch description.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 21/32] fs/aio: aio_wq isn't used in memory reclaim path
  2011-01-05 11:28     ` Tejun Heo
@ 2011-01-05 14:50       ` Jeff Moyer
  2011-01-05 15:00         ` Benjamin LaHaise
  0 siblings, 1 reply; 119+ messages in thread
From: Jeff Moyer @ 2011-01-05 14:50 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-kernel, Benjamin LaHaise, linux-aio

Tejun Heo <tj@kernel.org> writes:

> Hello,
>
> On Tue, Jan 04, 2011 at 10:56:20AM -0500, Jeff Moyer wrote:
>> > aio_wq isn't used during memory reclaim.  Convert to alloc_workqueue()
>> > without WQ_MEM_RECLAIM.  It's possible to use system_wq but given that
>> > the number of work items is determined from userland and the work item
>> > may block, enforcing strict concurrency limit would be a good idea.
>> 
>> I would think that just given that it may block would be enough to keep
>> it off of the system workqueue.
>
> Oh, workqueue now can handle parallel execution.  Blocking on system
> workqueue is no longer a problem.  One of the main reasons for this
> whole series.

OK, thanks for clarifying for me.

>> > @@ -85,7 +85,7 @@ static int __init aio_setup(void)
>> >  	kiocb_cachep = KMEM_CACHE(kiocb, SLAB_HWCACHE_ALIGN|SLAB_PANIC);
>> >  	kioctx_cachep = KMEM_CACHE(kioctx,SLAB_HWCACHE_ALIGN|SLAB_PANIC);
>> >  
>> > -	aio_wq = create_workqueue("aio");
>> > +	aio_wq = alloc_workqueue("aio", 0, 1);	/* used to limit concurrency */
>> 
>> OK, the only difference here is the removal of the WQ_MEM_RECLAIM flag,
>> as you noted.
>
> Yeap.  Do you agree that the concurrency limit is necessary?  If not,
> we can just put everything onto system_wq.

I'm not sure whether it's strictly necessary (there may very well be a
need for this in the usb gadgetfs code), but keeping it the same at
least seems safe.

>> > @@ -569,7 +569,7 @@ static int __aio_put_req(struct kioctx *ctx, struct kiocb *req)
>> >  		spin_lock(&fput_lock);
>> >  		list_add(&req->ki_list, &fput_head);
>> >  		spin_unlock(&fput_lock);
>> > -		queue_work(aio_wq, &fput_work);
>> > +		schedule_work(&fput_work);
>> 
>> I'm not sure where this change fits into the patch description.  Why did
>> you do this?
>
> Yeah, that's me being forgetful.  Now that aio_wq is solely used to
> throttle the max concurrency of aio work items, I thought it would be
> better to push fput_work to system workqueue so that it doesn't
> interact with aio work items.  I'll update the patch description.

OK, thanks.

-Jeff

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 21/32] fs/aio: aio_wq isn't used in memory reclaim path
  2011-01-05 14:50       ` Jeff Moyer
@ 2011-01-05 15:00         ` Benjamin LaHaise
  2011-01-05 15:49           ` Jeff Moyer
  0 siblings, 1 reply; 119+ messages in thread
From: Benjamin LaHaise @ 2011-01-05 15:00 UTC (permalink / raw)
  To: Jeff Moyer; +Cc: Tejun Heo, linux-kernel, linux-aio

On Wed, Jan 05, 2011 at 09:50:57AM -0500, Jeff Moyer wrote:
> > Yeap.  Do you agree that the concurrency limit is necessary?  If not,
> > we can just put everything onto system_wq.
> 
> I'm not sure whether it's strictly necessary (there may very well be a
> need for this in the usb gadgetfs code), but keeping it the same at
> least seems safe.

Limiting concurrency on aio requests is exactly the opposite of what the 
usb gadgetfs requires.  It's similarly bad for filesystem aio when there's 
a mix of small and large requests in flight.

		-ben

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 21/32] fs/aio: aio_wq isn't used in memory reclaim path
  2011-01-05 15:00         ` Benjamin LaHaise
@ 2011-01-05 15:49           ` Jeff Moyer
  0 siblings, 0 replies; 119+ messages in thread
From: Jeff Moyer @ 2011-01-05 15:49 UTC (permalink / raw)
  To: Benjamin LaHaise; +Cc: Tejun Heo, linux-kernel, linux-aio

Benjamin LaHaise <bcrl@kvack.org> writes:

> On Wed, Jan 05, 2011 at 09:50:57AM -0500, Jeff Moyer wrote:
>> > Yeap.  Do you agree that the concurrency limit is necessary?  If not,
>> > we can just put everything onto system_wq.
>> 
>> I'm not sure whether it's strictly necessary (there may very well be a
>> need for this in the usb gadgetfs code), but keeping it the same at
>> least seems safe.
>
> Limiting concurrency on aio requests is exactly the opposite of what the 
> usb gadgetfs requires.

I'll have to dig on what their requirements are.  After briefly looking
at mailing list archives, it appears they use the aio workqueue to queue
work after a completed I/O.  I think Zach actually had posted a patch to
change them over to using their own workqueue for that.  At any rate, it
may well be that they don't have a concurrency requirement (in fact, it
would be surprising if they did).  However, I wasn't going to propose
changing the way things were done w/o someone chiming in and saying they
needed it.

> It's similarly bad for filesystem aio when there's a mix of small and
> large requests in flight.

Well, the aio workqueue isn't actually used by the filesystem aio paths
at all (except for the fput_work, and that's being moved to the system
workqueue).

Cheers,
Jeff

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 09/32] drm/radeon: use system_wq instead of dev_priv->wq
  2011-01-05  0:21   ` Alex Deucher
@ 2011-01-06  4:31     ` Dave Airlie
  0 siblings, 0 replies; 119+ messages in thread
From: Dave Airlie @ 2011-01-06  4:31 UTC (permalink / raw)
  To: Alex Deucher; +Cc: Tejun Heo, linux-kernel, dri-devel

On Tue, 2011-01-04 at 19:21 -0500, Alex Deucher wrote:
> On Mon, Jan 3, 2011 at 8:49 AM, Tejun Heo <tj@kernel.org> wrote:
> > With cmwq, there's no reason for radeon to use a dedicated workqueue.
> > Drop dev_priv->wq and use system_wq instead.
> >
> > Because radeon_driver_irq_uninstall_kms() may be called from
> > unsleepable context, the work items can't be flushed from there.
> > Instead, init and flush from radeon_irq_kms_init/fini().
> >
> > While at it, simplify canceling/flushing of rdev->pm.dynpm_idle_work.
> > Always initialize and sync cancel instead of being unnecessarily smart
> > about it.
> >
> > Signed-off-by: Tejun Heo <tj@kernel.org>
> > Cc: David Airlie <airlied@linux.ie>
> > Cc: dri-devel@lists.freedesktop.org
> > ---
> > Only compile tested.  Please feel free to take it into the subsystem
> > tree or simply ack - I'll route it through the wq tree.
> 
> Patch looks good to me.  I'm not sure what's the best way to send this
> upstream.  I'm working on some irq changes in the same area now, so
> I'd prefer if we pushed it through Dave's tree, but I can handle it
> either way.

I'll pull it into my tree for merging to Linus.

Dave.

> 
> Acked-by: Alex Deucher <alexdeucher@gmail.com>
> 



^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 08/32] drm/nouveau: use system_wq instead of dev_priv->wq
  2011-01-05  1:16     ` Ben Skeggs
@ 2011-01-06 17:29       ` Tejun Heo
  2011-01-26 16:49         ` [PATCH UPDATED " Tejun Heo
  0 siblings, 1 reply; 119+ messages in thread
From: Tejun Heo @ 2011-01-06 17:29 UTC (permalink / raw)
  To: Ben Skeggs; +Cc: linux-kernel, dri-devel

Hello,

On Wed, Jan 05, 2011 at 11:16:05AM +1000, Ben Skeggs wrote:
> On Wed, 2011-01-05 at 11:07 +1000, Ben Skeggs wrote:
> > On Mon, 2011-01-03 at 14:49 +0100, Tejun Heo wrote:
> > > With cmwq, there's no reason for nouveau to use a dedicated workqueue.
> > > Drop dev_priv->wq and use system_wq instead.
> > > 
> > > Because nouveau_irq_uninstall() may be called from unsleepable
> > > context, the work items can't be flushed from there.  Instead, init
> > > and flush from nouveau_load/unload().
> > Ehh, ok, why not!  I'll push this through the nouveau tree, and it'll
> > get to Dave from there.
>
> On second thoughts, this won't apply on top of current nouveau code
> that's queued for 2.6.38.  Can you rebase on top of Dave's drm-next tree
> please.

We already missed this merge window, so I'll refresh the patch once
the window is closed and resend.

Thank you.

-- 
tejun

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 14/32] wireless/ipw2x00: use system_wq instead of dedicated workqueues
  2011-01-03 13:49 ` [PATCH 14/32] wireless/ipw2x00: " Tejun Heo
@ 2011-01-06 20:51   ` John W. Linville
  0 siblings, 0 replies; 119+ messages in thread
From: John W. Linville @ 2011-01-06 20:51 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-kernel, linux-wireless

On Mon, Jan 03, 2011 at 02:49:37PM +0100, Tejun Heo wrote:
> With cmwq, there's no reason to use separate workqueues in ipw2x00
> drivers.  Drop them and use system_wq instead.  All used work items
> are sync canceled on driver detach.
> 
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: "John W. Linville" <linville@tuxdriver.com>
> Cc: linux-wireless@vger.kernel.org
> ---
> Only compile tested.  Please feel free to take it into the subsystem
> tree or simply ack - I'll route it through the wq tree.

ACK

-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 11/32] v4l/cx18: update workqueue usage
  2011-01-03 13:49 ` [PATCH 11/32] v4l/cx18: update workqueue usage Tejun Heo
  2011-01-04  0:54   ` Andy Walls
@ 2011-01-08 17:03   ` Andy Walls
  1 sibling, 0 replies; 119+ messages in thread
From: Andy Walls @ 2011-01-08 17:03 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-kernel, linux-media

On Mon, 2011-01-03 at 14:49 +0100, Tejun Heo wrote:
> With cmwq, there's no reason to use separate out_work_queue.  Drop it
> and use system_wq instead.  The in_work_queue needs to be ordered so
> can't use one of the system wqs; however, as it isn't used to reclaim
> memory, allocate the workqueue with alloc_ordered_workqueue() without
> WQ_MEM_RECLAIM.
> 
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: Andy Walls <awalls@md.metrocast.net>
> Cc: linux-media@vger.kernel.org
> ---
> Only compile tested.  Please feel free to take it into the subsystem
> tree or simply ack - I'll route it through the wq tree.

Reviewed-by: Andy Walls <awalls@md.metrocast.net>
Acked-by: Andy Walls <awalls@md.metrocast.net>

Sorry it took so long for me to review.
Please route via your wq tree for the cx18 driver.

Thanks,
Andy

> Thanks.
> 
>  drivers/media/video/cx18/cx18-driver.c  |   24 ++----------------------
>  drivers/media/video/cx18/cx18-driver.h  |    3 ---
>  drivers/media/video/cx18/cx18-streams.h |    3 +--
>  3 files changed, 3 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/media/video/cx18/cx18-driver.c b/drivers/media/video/cx18/cx18-driver.c
> index df60f27..41c0822 100644
> --- a/drivers/media/video/cx18/cx18-driver.c
> +++ b/drivers/media/video/cx18/cx18-driver.c
> @@ -656,7 +656,7 @@ static int __devinit cx18_create_in_workq(struct cx18 *cx)
>  {
>  	snprintf(cx->in_workq_name, sizeof(cx->in_workq_name), "%s-in",
>  		 cx->v4l2_dev.name);
> -	cx->in_work_queue = create_singlethread_workqueue(cx->in_workq_name);
> +	cx->in_work_queue = alloc_ordered_workqueue(cx->in_workq_name, 0);
>  	if (cx->in_work_queue == NULL) {
>  		CX18_ERR("Unable to create incoming mailbox handler thread\n");
>  		return -ENOMEM;
> @@ -664,18 +664,6 @@ static int __devinit cx18_create_in_workq(struct cx18 *cx)
>  	return 0;
>  }
>  
> -static int __devinit cx18_create_out_workq(struct cx18 *cx)
> -{
> -	snprintf(cx->out_workq_name, sizeof(cx->out_workq_name), "%s-out",
> -		 cx->v4l2_dev.name);
> -	cx->out_work_queue = create_workqueue(cx->out_workq_name);
> -	if (cx->out_work_queue == NULL) {
> -		CX18_ERR("Unable to create outgoing mailbox handler threads\n");
> -		return -ENOMEM;
> -	}
> -	return 0;
> -}
> -
>  static void __devinit cx18_init_in_work_orders(struct cx18 *cx)
>  {
>  	int i;
> @@ -702,15 +690,9 @@ static int __devinit cx18_init_struct1(struct cx18 *cx)
>  	mutex_init(&cx->epu2apu_mb_lock);
>  	mutex_init(&cx->epu2cpu_mb_lock);
>  
> -	ret = cx18_create_out_workq(cx);
> -	if (ret)
> -		return ret;
> -
>  	ret = cx18_create_in_workq(cx);
> -	if (ret) {
> -		destroy_workqueue(cx->out_work_queue);
> +	if (ret)
>  		return ret;
> -	}
>  
>  	cx18_init_in_work_orders(cx);
>  
> @@ -1094,7 +1076,6 @@ free_mem:
>  	release_mem_region(cx->base_addr, CX18_MEM_SIZE);
>  free_workqueues:
>  	destroy_workqueue(cx->in_work_queue);
> -	destroy_workqueue(cx->out_work_queue);
>  err:
>  	if (retval == 0)
>  		retval = -ENODEV;
> @@ -1244,7 +1225,6 @@ static void cx18_remove(struct pci_dev *pci_dev)
>  	cx18_halt_firmware(cx);
>  
>  	destroy_workqueue(cx->in_work_queue);
> -	destroy_workqueue(cx->out_work_queue);
>  
>  	cx18_streams_cleanup(cx, 1);
>  
> diff --git a/drivers/media/video/cx18/cx18-driver.h b/drivers/media/video/cx18/cx18-driver.h
> index 77be58c..f7f71d1 100644
> --- a/drivers/media/video/cx18/cx18-driver.h
> +++ b/drivers/media/video/cx18/cx18-driver.h
> @@ -614,9 +614,6 @@ struct cx18 {
>  	struct cx18_in_work_order in_work_order[CX18_MAX_IN_WORK_ORDERS];
>  	char epu_debug_str[256]; /* CX18_EPU_DEBUG is rare: use shared space */
>  
> -	struct workqueue_struct *out_work_queue;
> -	char out_workq_name[12]; /* "cx18-NN-out" */
> -
>  	/* i2c */
>  	struct i2c_adapter i2c_adap[2];
>  	struct i2c_algo_bit_data i2c_algo[2];
> diff --git a/drivers/media/video/cx18/cx18-streams.h b/drivers/media/video/cx18/cx18-streams.h
> index 77412be..5837ffb 100644
> --- a/drivers/media/video/cx18/cx18-streams.h
> +++ b/drivers/media/video/cx18/cx18-streams.h
> @@ -41,8 +41,7 @@ static inline bool cx18_stream_enabled(struct cx18_stream *s)
>  /* Related to submission of mdls to firmware */
>  static inline void cx18_stream_load_fw_queue(struct cx18_stream *s)
>  {
> -	struct cx18 *cx = s->cx;
> -	queue_work(cx->out_work_queue, &s->out_work_order);
> +	schedule_work(&s->out_work_order);
>  }
>  
>  static inline void cx18_stream_put_mdl_fw(struct cx18_stream *s,



^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 17/32] scsi/ibmvstgt: use system_wq instead of vtgtd workqueue
  2011-01-03 13:49 ` [PATCH 17/32] scsi/ibmvstgt: use system_wq instead of vtgtd workqueue Tejun Heo
  2011-01-03 17:45   ` Bart Van Assche
@ 2011-01-24 16:09   ` Bart Van Assche
  2011-01-24 16:24     ` Tejun Heo
  1 sibling, 1 reply; 119+ messages in thread
From: Bart Van Assche @ 2011-01-24 16:09 UTC (permalink / raw)
  To: Tejun Heo
  Cc: linux-kernel, FUJITA Tomonori, James E.J. Bottomley, linux-scsi,
	Brian King, Robert Jennings

On Mon, Jan 3, 2011 at 2:49 PM, Tejun Heo <tj@kernel.org> wrote:
>
> The target driver is not in the memory reclaim path and doesn't need a
> dedicated workqueue.  Drop vtgtd and use system_wq instead.  The used
> work item is sync flushed on removal.
>
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
> Cc: linux-scsi@vger.kernel.org
> ---
> Only compile tested.  Please feel free to take it into the subsystem
> tree or simply ack - I'll route it through the wq tree.
>
> Thanks.
>
>  drivers/scsi/ibmvscsi/ibmvstgt.c |   15 ++++-----------
>  1 files changed, 4 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/scsi/ibmvscsi/ibmvstgt.c b/drivers/scsi/ibmvscsi/ibmvstgt.c
> index 2256bab..47fc632 100644
> --- a/drivers/scsi/ibmvscsi/ibmvstgt.c
> +++ b/drivers/scsi/ibmvscsi/ibmvstgt.c
> @@ -74,7 +74,6 @@ struct vio_port {
>        struct srp_rport *rport;
>  };
>
> -static struct workqueue_struct *vtgtd;
>  static struct scsi_transport_template *ibmvstgt_transport_template;
>
>  /*
> @@ -546,7 +545,7 @@ static irqreturn_t ibmvstgt_interrupt(int dummy, void *data)
>        struct vio_port *vport = target_to_port(target);
>
>        vio_disable_interrupts(vport->dma_dev);
> -       queue_work(vtgtd, &vport->crq_work);
> +       schedule_work(&vport->crq_work);
>
>        return IRQ_HANDLED;
>  }
> @@ -900,6 +899,7 @@ static int ibmvstgt_remove(struct vio_dev *dev)
>        crq_queue_destroy(target);
>        srp_remove_host(shost);
>        scsi_remove_host(shost);
> +       flush_work_sync(&vport->crq_work);
>        scsi_tgt_free_queue(shost);
>        srp_target_free(target);
>        kfree(vport);
> @@ -967,21 +967,15 @@ static int __init ibmvstgt_init(void)
>        if (!ibmvstgt_transport_template)
>                return err;
>
> -       vtgtd = create_workqueue("ibmvtgtd");
> -       if (!vtgtd)
> -               goto release_transport;
> -
>        err = get_system_info();
>        if (err)
> -               goto destroy_wq;
> +               goto release_transport;
>
>        err = vio_register_driver(&ibmvstgt_driver);
>        if (err)
> -               goto destroy_wq;
> +               goto release_transport;
>
>        return 0;
> -destroy_wq:
> -       destroy_workqueue(vtgtd);
>  release_transport:
>        srp_release_transport(ibmvstgt_transport_template);
>        return err;
> @@ -991,7 +985,6 @@ static void __exit ibmvstgt_exit(void)
>  {
>        printk("Unregister IBM virtual SCSI driver\n");
>
> -       destroy_workqueue(vtgtd);
>        vio_unregister_driver(&ibmvstgt_driver);
>        srp_release_transport(ibmvstgt_transport_template);
>  }

(added Brian King and Robert Jennings in CC)

Hello Tejun,

Insertion of  flush_work_sync() fixes a race - that's a good catch.
flush_work_sync() should be invoked a little earlier though because
the scheduled work may access the queue destroyed by the
crq_queue_destroy(target) call. And the CRQ interrupt should be
disabled from before flush_work_sync() is invoked until after the CRQ
has been destroyed.

Regarding the queue removal: I might have missed something, but why
would you like to remove the vtgtd work queue ? Since the ibmvstgt
driver is a storage target driver, processing latency matters. I'm
afraid that switching from a dedicated queue to the global work queue
will increase processing latency.

Bart.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 17/32] scsi/ibmvstgt: use system_wq instead of vtgtd workqueue
  2011-01-24 16:09   ` Bart Van Assche
@ 2011-01-24 16:24     ` Tejun Heo
  2011-02-01 10:40       ` Tejun Heo
  0 siblings, 1 reply; 119+ messages in thread
From: Tejun Heo @ 2011-01-24 16:24 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: linux-kernel, FUJITA Tomonori, James E.J. Bottomley, linux-scsi,
	Brian King, Robert Jennings

Hello,

On Mon, Jan 24, 2011 at 05:09:18PM +0100, Bart Van Assche wrote:
> Insertion of  flush_work_sync() fixes a race - that's a good catch.
> flush_work_sync() should be invoked a little earlier though because
> the scheduled work may access the queue destroyed by the
> crq_queue_destroy(target) call. And the CRQ interrupt should be
> disabled from before flush_work_sync() is invoked until after the CRQ
> has been destroyed.

Heh, I'm a bit out of my depth here.  If you know what's necessary,
please go ahead and make the change.

> Regarding the queue removal: I might have missed something, but why
> would you like to remove the vtgtd work queue ? Since the ibmvstgt
> driver is a storage target driver, processing latency matters. I'm
> afraid that switching from a dedicated queue to the global work queue
> will increase processing latency.

Having a dedicated workqueue no longer makes any difference regarding
processing latency.  Each workqueue is mere frontend to the shared
worker pool anyway.  Dedicated workqueues are now meaningful only as
forward progress guarantee, attribute and/or flush domain - IOW, when
the workqueue needs to be used during memory reclaim, the work items
need to have specific attributes or certain group of work items need
to be flushed together.  Apart from that, there's virtually no
difference between using the system_wq and a dedicated one.  As using
the system one is usually simpler, it's natural to do that.

Thank you.

-- 
tejun

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 20/32] video/msm_fb: use system_wq instead of dedicated workqueues
  2011-01-03 18:10           ` Daniel Walker
@ 2011-01-25 13:45               ` Tejun Heo
  -1 siblings, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-25 13:45 UTC (permalink / raw)
  To: Daniel Walker
  Cc: Stanislaw Gruszka, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	Stanislaw Gruszka, linux-usb-u79uwXL29TY76Z2rM5mHXA, David Brown,
	Bryan Huntsman, linux-arm-msm-u79uwXL29TY76Z2rM5mHXA

On Mon, Jan 03, 2011 at 10:10:45AM -0800, Daniel Walker wrote:
> On Mon, 2011-01-03 at 18:06 +0100, Stanislaw Gruszka wrote:
> > On Mon, Jan 03, 2011 at 02:49:43PM +0100, Tejun Heo wrote:
> > > With cmwq, there's no reason to use separate workqueues.  Drop
> > > msmfb_info->resume_workqueue and use system_wq instead.
> > > 
> > > Signed-off-by: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> > > Cc: Stanislaw Gruszka <stf_xl-5tc4TXWwyLM@public.gmane.org>
> > I'm not the right person, CC according to MAINTAINERS
> 
> ARM/QUALCOMM MSM MACHINE SUPPORT
> M:      David Brown <davidb-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
> M:      Daniel Walker <dwalker-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
> M:      Bryan Huntsman <bryanh-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>

Oops, sorry about that.  So how does the patch look?  Are you gonna
take it through msm tree or shall I take it?

Thanks.

-- 
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 20/32] video/msm_fb: use system_wq instead of dedicated workqueues
@ 2011-01-25 13:45               ` Tejun Heo
  0 siblings, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-25 13:45 UTC (permalink / raw)
  To: Daniel Walker
  Cc: Stanislaw Gruszka, linux-kernel, Stanislaw Gruszka, linux-usb,
	David Brown, Bryan Huntsman, linux-arm-msm

On Mon, Jan 03, 2011 at 10:10:45AM -0800, Daniel Walker wrote:
> On Mon, 2011-01-03 at 18:06 +0100, Stanislaw Gruszka wrote:
> > On Mon, Jan 03, 2011 at 02:49:43PM +0100, Tejun Heo wrote:
> > > With cmwq, there's no reason to use separate workqueues.  Drop
> > > msmfb_info->resume_workqueue and use system_wq instead.
> > > 
> > > Signed-off-by: Tejun Heo <tj@kernel.org>
> > > Cc: Stanislaw Gruszka <stf_xl@wp.pl>
> > I'm not the right person, CC according to MAINTAINERS
> 
> ARM/QUALCOMM MSM MACHINE SUPPORT
> M:      David Brown <davidb@codeaurora.org>
> M:      Daniel Walker <dwalker@codeaurora.org>
> M:      Bryan Huntsman <bryanh@codeaurora.org>

Oops, sorry about that.  So how does the patch look?  Are you gonna
take it through msm tree or shall I take it?

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 01/32] arm/omap: use system_wq in mailbox
  2011-01-04  5:24     ` Tejun Heo
@ 2011-01-25 13:47       ` Tejun Heo
  2011-01-25 15:34           ` Hari Kanigeri
  0 siblings, 1 reply; 119+ messages in thread
From: Tejun Heo @ 2011-01-25 13:47 UTC (permalink / raw)
  To: Kanigeri, Hari; +Cc: linux-kernel, Tony Lindgren, linux-omap

On Tue, Jan 04, 2011 at 06:24:21AM +0100, Tejun Heo wrote:
> Using dedicated workqueue or system_wq doesn't make any difference in
> terms of execution latency anymore.  Sleeping work items no longer
> delay execution of other work items.  If mailbox is very latency
> sensitive, it might make sense to create a HIGHPRI workqueue but that
> usually isn't necessary.

Ping.  Shall I apply the patch?

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 10/32] input/tps6507x-ts: use system_wq instead of dedicated workqueue
  2011-01-03 16:34     ` Todd Fischer
@ 2011-01-25 14:19       ` Tejun Heo
  2011-01-25 16:13         ` Todd Fischer
  0 siblings, 1 reply; 119+ messages in thread
From: Tejun Heo @ 2011-01-25 14:19 UTC (permalink / raw)
  To: Todd Fischer; +Cc: Dan Carpenter, linux-kernel, Dmitry Torokhov, linux-input

On Mon, Jan 03, 2011 at 09:34:43AM -0700, Todd Fischer wrote:
> Hi Dan,
> 
> Polling is only necessary because I was given brain dead hardware.
> I was expecting updated hardware with the interrupt signal connected
> properly, but haven't received it yet.
> 
> Any reasonable hardware will not need tps6507x-ts polling.  I was
> under the impression I could only push patches that I have tested.
> Since I haven't tested an interrupt version of the driver, I didn't
> include a patch that removes the polling and replaces it with
> interrupts.
> 
> I have another customer planning on using the TPS6507x chip for
> touch screen.  I expect their hardware in around 3 weeks.

Shall I apply the patch?

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCHSET] workqueue: update workqueue users - replace create_workqueue()
  2011-01-03 13:49 [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
                   ` (31 preceding siblings ...)
  2011-01-03 13:49 ` [PATCH 32/32] rxrpc: rxrpc_workqueue isn't used during memory reclaim Tejun Heo
@ 2011-01-25 14:29 ` Tejun Heo
  2011-01-25 16:26   ` Dave Jones
                     ` (3 more replies)
  32 siblings, 4 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-25 14:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: lenb, linux-acpi, davej, cpufreq, Markus.Lidel, tomas.winkler,
	jayamohank, andrew.vasquez, James.Bottomley, linux-scsi, tomof,
	stf_xl, linux-usb, tytso, mfasheh, joel.becker, reiserfs-devel,
	aelder, hch, ericvh, rminnich, v9fs-developer, lucho,
	andy.grover

Hello,

There was no response for the following patches and I'm planning on
routing them through workqueue#for-2.6.39.  If you have an objection
or want to take the patch through a different tree, please let me
know.

 0006-acpi-kacpi-_wq-don-t-need-WQ_MEM_RECLAIM.patch
 0007-cpufreq-use-system_wq-instead-of-dedicated-workqueue.patch
 0012-i2o-use-alloc_workqueue-instead-of-create_workqueue.patch
 0013-misc-iwmc3200top-use-system_wq-instead-of-dedicated-.patch
 0016-scsi-be2iscsi-qla2xxx-convert-to-alloc_workqueue.patch
 0018-scsi-scsi_tgt_lib-scsi_tgtd-isn-t-used-in-memory-rec.patch
 0019-usb-ueagle-atm-use-system_wq-instead-of-dedicated-wo.patch
 0025-ext4-convert-to-alloc_workqueue.patch
 0026-ocfs2-use-system_wq-instead-of-ocfs2_quota_wq.patch
 0027-reiserfs-make-commit_wq-use-the-default-concurrency-.patch
 0028-xfs-convert-to-alloc_workqueue.patch
 0029-net-9p-use-system_wq-instead-of-p9_mux_wq.patch
 0030-net-9p-replace-p9_poll_task-with-a-work.patch
 0031-rds-ib-use-system_wq-instead-of-rds_ib_fmr_wq.patch

The whole series can be found at the following URL.

 http://thread.gmane.org/gmane.linux.kernel/1082587

Thank you.

-- 
tejun

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 01/32] arm/omap: use system_wq in mailbox
  2011-01-25 13:47       ` Tejun Heo
@ 2011-01-25 15:34           ` Hari Kanigeri
  0 siblings, 0 replies; 119+ messages in thread
From: Hari Kanigeri @ 2011-01-25 15:34 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-kernel, Tony Lindgren, linux-omap

Tejun,

On Tue, Jan 25, 2011 at 5:47 AM, Tejun Heo <tj@kernel.org> wrote:
> On Tue, Jan 04, 2011 at 06:24:21AM +0100, Tejun Heo wrote:
>> Using dedicated workqueue or system_wq doesn't make any difference in
>> terms of execution latency anymore.  Sleeping work items no longer
>> delay execution of other work items.  If mailbox is very latency
>> sensitive, it might make sense to create a HIGHPRI workqueue but that
>> usually isn't necessary.
>
> Ping.  Shall I apply the patch?
>
I am sorry for the delay in acking your response.  Your patch looks good to me.

thank you,
best regards,
Hari

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 01/32] arm/omap: use system_wq in mailbox
@ 2011-01-25 15:34           ` Hari Kanigeri
  0 siblings, 0 replies; 119+ messages in thread
From: Hari Kanigeri @ 2011-01-25 15:34 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-kernel, Tony Lindgren, linux-omap

Tejun,

On Tue, Jan 25, 2011 at 5:47 AM, Tejun Heo <tj@kernel.org> wrote:
> On Tue, Jan 04, 2011 at 06:24:21AM +0100, Tejun Heo wrote:
>> Using dedicated workqueue or system_wq doesn't make any difference in
>> terms of execution latency anymore.  Sleeping work items no longer
>> delay execution of other work items.  If mailbox is very latency
>> sensitive, it might make sense to create a HIGHPRI workqueue but that
>> usually isn't necessary.
>
> Ping.  Shall I apply the patch?
>
I am sorry for the delay in acking your response.  Your patch looks good to me.

thank you,
best regards,
Hari
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 01/32] arm/omap: use system_wq in mailbox
  2011-01-25 15:34           ` Hari Kanigeri
  (?)
@ 2011-01-25 15:37           ` Tejun Heo
  -1 siblings, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-25 15:37 UTC (permalink / raw)
  To: Hari Kanigeri; +Cc: linux-kernel, Tony Lindgren, linux-omap

On Tue, Jan 25, 2011 at 07:34:08AM -0800, Hari Kanigeri wrote:
> Tejun,
> 
> On Tue, Jan 25, 2011 at 5:47 AM, Tejun Heo <tj@kernel.org> wrote:
> > On Tue, Jan 04, 2011 at 06:24:21AM +0100, Tejun Heo wrote:
> >> Using dedicated workqueue or system_wq doesn't make any difference in
> >> terms of execution latency anymore.  Sleeping work items no longer
> >> delay execution of other work items.  If mailbox is very latency
> >> sensitive, it might make sense to create a HIGHPRI workqueue but that
> >> usually isn't necessary.
> >
> > Ping.  Shall I apply the patch?
> >
> I am sorry for the delay in acking your response.  Your patch looks good to me.

Thanks.  Acked-by added.

-- 
tejun

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 10/32] input/tps6507x-ts: use system_wq instead of dedicated workqueue
  2011-01-25 14:19       ` Tejun Heo
@ 2011-01-25 16:13         ` Todd Fischer
  2011-01-25 16:50           ` Dmitry Torokhov
  0 siblings, 1 reply; 119+ messages in thread
From: Todd Fischer @ 2011-01-25 16:13 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Dan Carpenter, linux-kernel, Dmitry Torokhov, linux-input

On 01/25/2011 07:19 AM, Tejun Heo wrote:
> Shall I apply the patch?
> Thanks
Yes, apply the patch.  I am not sure of the syntax for attaching my sign 
off.  Hope this is okay.

Todd

Signed-off-by: Todd Fischer<todd.fischer@ridgerun.com>



^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCHSET] workqueue: update workqueue users - replace create_workqueue()
  2011-01-25 14:29 ` [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
@ 2011-01-25 16:26   ` Dave Jones
  2011-01-26 10:40     ` Tejun Heo
  2011-01-25 17:47   ` Madhu Iyengar
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 119+ messages in thread
From: Dave Jones @ 2011-01-25 16:26 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-kernel, lenb, linux-acpi, cpufreq

On Tue, Jan 25, 2011 at 03:29:21PM +0100, Tejun Heo wrote:
 > Hello,
 > 
 > There was no response for the following patches and I'm planning on
 > routing them through workqueue#for-2.6.39.  If you have an objection
 > or want to take the patch through a different tree, please let me
 > know.
 > ..
 >  0007-cpufreq-use-system_wq-instead-of-dedicated-workqueue.patch

Feel free to add my 
Signed-off-by: Dave Jones <davej@redhat.com> 
to this.

I looked it over, and didn't see anything objectionable.

	Dave

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 10/32] input/tps6507x-ts: use system_wq instead of dedicated workqueue
  2011-01-25 16:13         ` Todd Fischer
@ 2011-01-25 16:50           ` Dmitry Torokhov
  2011-01-26 10:43             ` Tejun Heo
  0 siblings, 1 reply; 119+ messages in thread
From: Dmitry Torokhov @ 2011-01-25 16:50 UTC (permalink / raw)
  To: Todd Fischer; +Cc: Tejun Heo, Dan Carpenter, linux-kernel, linux-input

On Tue, Jan 25, 2011 at 09:13:45AM -0700, Todd Fischer wrote:
> On 01/25/2011 07:19 AM, Tejun Heo wrote:
> >Shall I apply the patch?
> >Thanks
> Yes, apply the patch.  I am not sure of the syntax for attaching my
> sign off.  Hope this is okay.
> 
> Todd
> 
> Signed-off-by: Todd Fischer<todd.fischer@ridgerun.com>
> 

That should be Acked-by since you are not passing the patch along.

Fine with the as well.

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 119+ messages in thread

* RE: [PATCHSET] workqueue: update workqueue users - replace create_workqueue()
  2011-01-25 14:29 ` [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
  2011-01-25 16:26   ` Dave Jones
@ 2011-01-25 17:47   ` Madhu Iyengar
  2011-01-26  4:46   ` Greg KH
  2011-02-01 10:44   ` Tejun Heo
  3 siblings, 0 replies; 119+ messages in thread
From: Madhu Iyengar @ 2011-01-25 17:47 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Andrew Vasquez, linux-scsi, Giridhar Malavali, Madhu Iyengar

Tejun,

Here's my ack for patch #16 from the QLogic side:

Acked-by: Madhuranath Iyengar <Madhu.Iyengar@qlogic.com>

Cheers,
Madhu

-----Original Message-----
From: linux-scsi-owner@vger.kernel.org [mailto:linux-scsi-owner@vger.kernel.org] On Behalf Of Tejun Heo
Sent: Tuesday, January 25, 2011 6:29 AM
To: linux-kernel@vger.kernel.org
Cc: lenb@kernel.org; linux-acpi@vger.kernel.org; davej@redhat.com; cpufreq@vger.kernel.org; Markus.Lidel@shadowconnect.com; tomas.winkler@intel.com; jayamohank@serverengines.com; Andrew Vasquez; James.Bottomley@HansenPartnership.com; linux-scsi@vger.kernel.org; tomof@acm.org; stf_xl@wp.pl; linux-usb@vger.kernel.org; tytso@mit.edu; mfasheh@suse.com; joel.becker@oracle.com; reiserfs-devel@vger.kernel.org; aelder@sgi.com; hch@infradead.org; ericvh@gmail.com; rminnich@sandia.gov; v9fs-developer@lists.sourceforge.net; lucho@ionkov.net; andy.grover@oracle.com
Subject: Re: [PATCHSET] workqueue: update workqueue users - replace create_workqueue()

Hello,

There was no response for the following patches and I'm planning on
routing them through workqueue#for-2.6.39.  If you have an objection
or want to take the patch through a different tree, please let me
know.

 0006-acpi-kacpi-_wq-don-t-need-WQ_MEM_RECLAIM.patch
 0007-cpufreq-use-system_wq-instead-of-dedicated-workqueue.patch
 0012-i2o-use-alloc_workqueue-instead-of-create_workqueue.patch
 0013-misc-iwmc3200top-use-system_wq-instead-of-dedicated-.patch
 0016-scsi-be2iscsi-qla2xxx-convert-to-alloc_workqueue.patch
 0018-scsi-scsi_tgt_lib-scsi_tgtd-isn-t-used-in-memory-rec.patch
 0019-usb-ueagle-atm-use-system_wq-instead-of-dedicated-wo.patch
 0025-ext4-convert-to-alloc_workqueue.patch
 0026-ocfs2-use-system_wq-instead-of-ocfs2_quota_wq.patch
 0027-reiserfs-make-commit_wq-use-the-default-concurrency-.patch
 0028-xfs-convert-to-alloc_workqueue.patch
 0029-net-9p-use-system_wq-instead-of-p9_mux_wq.patch
 0030-net-9p-replace-p9_poll_task-with-a-work.patch
 0031-rds-ib-use-system_wq-instead-of-rds_ib_fmr_wq.patch

The whole series can be found at the following URL.

 http://thread.gmane.org/gmane.linux.kernel/1082587

Thank you.

--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


This message and any attached documents contain information from QLogic Corporation or its wholly-owned subsidiaries that may be confidential. If you are not the intended recipient, you may not read, copy, distribute, or use this information. If you have received this transmission in error, please notify the sender immediately by reply e-mail and then delete this message.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 20/32] video/msm_fb: use system_wq instead of dedicated workqueues
  2011-01-25 13:45               ` Tejun Heo
@ 2011-01-25 18:00                   ` Daniel Walker
  -1 siblings, 0 replies; 119+ messages in thread
From: Daniel Walker @ 2011-01-25 18:00 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Stanislaw Gruszka, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	Stanislaw Gruszka, linux-usb-u79uwXL29TY76Z2rM5mHXA, David Brown,
	Bryan Huntsman, linux-arm-msm-u79uwXL29TY76Z2rM5mHXA

On Tue, 2011-01-25 at 14:45 +0100, Tejun Heo wrote:
> On Mon, Jan 03, 2011 at 10:10:45AM -0800, Daniel Walker wrote:
> > On Mon, 2011-01-03 at 18:06 +0100, Stanislaw Gruszka wrote:
> > > On Mon, Jan 03, 2011 at 02:49:43PM +0100, Tejun Heo wrote:
> > > > With cmwq, there's no reason to use separate workqueues.  Drop
> > > > msmfb_info->resume_workqueue and use system_wq instead.
> > > > 
> > > > Signed-off-by: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> > > > Cc: Stanislaw Gruszka <stf_xl-5tc4TXWwyLM@public.gmane.org>
> > > I'm not the right person, CC according to MAINTAINERS
> > 
> > ARM/QUALCOMM MSM MACHINE SUPPORT
> > M:      David Brown <davidb-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
> > M:      Daniel Walker <dwalker-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
> > M:      Bryan Huntsman <bryanh-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
> 
> Oops, sorry about that.  So how does the patch look?  Are you gonna
> take it through msm tree or shall I take it?

David ?

Daniel

-- 

Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 20/32] video/msm_fb: use system_wq instead of dedicated workqueues
@ 2011-01-25 18:00                   ` Daniel Walker
  0 siblings, 0 replies; 119+ messages in thread
From: Daniel Walker @ 2011-01-25 18:00 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Stanislaw Gruszka, linux-kernel, Stanislaw Gruszka, linux-usb,
	David Brown, Bryan Huntsman, linux-arm-msm

On Tue, 2011-01-25 at 14:45 +0100, Tejun Heo wrote:
> On Mon, Jan 03, 2011 at 10:10:45AM -0800, Daniel Walker wrote:
> > On Mon, 2011-01-03 at 18:06 +0100, Stanislaw Gruszka wrote:
> > > On Mon, Jan 03, 2011 at 02:49:43PM +0100, Tejun Heo wrote:
> > > > With cmwq, there's no reason to use separate workqueues.  Drop
> > > > msmfb_info->resume_workqueue and use system_wq instead.
> > > > 
> > > > Signed-off-by: Tejun Heo <tj@kernel.org>
> > > > Cc: Stanislaw Gruszka <stf_xl@wp.pl>
> > > I'm not the right person, CC according to MAINTAINERS
> > 
> > ARM/QUALCOMM MSM MACHINE SUPPORT
> > M:      David Brown <davidb@codeaurora.org>
> > M:      Daniel Walker <dwalker@codeaurora.org>
> > M:      Bryan Huntsman <bryanh@codeaurora.org>
> 
> Oops, sorry about that.  So how does the patch look?  Are you gonna
> take it through msm tree or shall I take it?

David ?

Daniel

-- 

Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.


^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 20/32] video/msm_fb: use system_wq instead of dedicated workqueues
  2011-01-25 18:00                   ` Daniel Walker
  (?)
@ 2011-01-25 19:14                   ` David Brown
  2011-01-25 19:16                     ` Daniel Walker
  -1 siblings, 1 reply; 119+ messages in thread
From: David Brown @ 2011-01-25 19:14 UTC (permalink / raw)
  To: Daniel Walker
  Cc: Tejun Heo, Stanislaw Gruszka, linux-kernel, Stanislaw Gruszka,
	linux-usb, Bryan Huntsman, linux-arm-msm

On Tue, Jan 25 2011, Daniel Walker wrote:

> On Tue, 2011-01-25 at 14:45 +0100, Tejun Heo wrote:
>> On Mon, Jan 03, 2011 at 10:10:45AM -0800, Daniel Walker wrote:
>> > On Mon, 2011-01-03 at 18:06 +0100, Stanislaw Gruszka wrote:
>> > > On Mon, Jan 03, 2011 at 02:49:43PM +0100, Tejun Heo wrote:
>> > > > With cmwq, there's no reason to use separate workqueues.  Drop
>> > > > msmfb_info->resume_workqueue and use system_wq instead.
>> > > > 
>> > > > Signed-off-by: Tejun Heo <tj@kernel.org>
>> > > > Cc: Stanislaw Gruszka <stf_xl@wp.pl>
>> > > I'm not the right person, CC according to MAINTAINERS
>> > 
>> > ARM/QUALCOMM MSM MACHINE SUPPORT
>> > M:      David Brown <davidb@codeaurora.org>
>> > M:      Daniel Walker <dwalker@codeaurora.org>
>> > M:      Bryan Huntsman <bryanh@codeaurora.org>
>> 
>> Oops, sorry about that.  So how does the patch look?  Are you gonna
>> take it through msm tree or shall I take it?
>
> David ?
>
> Daniel

Is it difficult for you to test this change, Daniel?  I can pull it in
once we verify it still works.

Thanks,
David

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 20/32] video/msm_fb: use system_wq instead of dedicated workqueues
  2011-01-25 19:14                   ` David Brown
@ 2011-01-25 19:16                     ` Daniel Walker
       [not found]                       ` <1295982976.25496.29.camel-y5Owza0q8UhBVvN7MMdr1KRtKmQZhJ7pQQ4Iyu8u01E@public.gmane.org>
  0 siblings, 1 reply; 119+ messages in thread
From: Daniel Walker @ 2011-01-25 19:16 UTC (permalink / raw)
  To: David Brown
  Cc: Tejun Heo, Stanislaw Gruszka, linux-kernel, Stanislaw Gruszka,
	linux-usb, Bryan Huntsman, linux-arm-msm

On Tue, 2011-01-25 at 11:14 -0800, David Brown wrote:
> On Tue, Jan 25 2011, Daniel Walker wrote:
> 
> > On Tue, 2011-01-25 at 14:45 +0100, Tejun Heo wrote:
> >> On Mon, Jan 03, 2011 at 10:10:45AM -0800, Daniel Walker wrote:
> >> > On Mon, 2011-01-03 at 18:06 +0100, Stanislaw Gruszka wrote:
> >> > > On Mon, Jan 03, 2011 at 02:49:43PM +0100, Tejun Heo wrote:
> >> > > > With cmwq, there's no reason to use separate workqueues.  Drop
> >> > > > msmfb_info->resume_workqueue and use system_wq instead.
> >> > > > 
> >> > > > Signed-off-by: Tejun Heo <tj@kernel.org>
> >> > > > Cc: Stanislaw Gruszka <stf_xl@wp.pl>
> >> > > I'm not the right person, CC according to MAINTAINERS
> >> > 
> >> > ARM/QUALCOMM MSM MACHINE SUPPORT
> >> > M:      David Brown <davidb@codeaurora.org>
> >> > M:      Daniel Walker <dwalker@codeaurora.org>
> >> > M:      Bryan Huntsman <bryanh@codeaurora.org>
> >> 
> >> Oops, sorry about that.  So how does the patch look?  Are you gonna
> >> take it through msm tree or shall I take it?
> >
> > David ?
> >
> > Daniel
> 
> Is it difficult for you to test this change, Daniel?  I can pull it in
> once we verify it still works.

Carl V. can test it, and review it I think ..

Daniel

-- 

Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 20/32] video/msm_fb: use system_wq instead of dedicated workqueues
  2011-01-25 19:16                     ` Daniel Walker
@ 2011-01-25 22:08                           ` Carl Vanderlip
  0 siblings, 0 replies; 119+ messages in thread
From: Carl Vanderlip @ 2011-01-25 22:08 UTC (permalink / raw)
  To: Daniel Walker
  Cc: David Brown, Tejun Heo, Stanislaw Gruszka,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Stanislaw Gruszka,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, Bryan Huntsman,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA

On Tue, 2011-01-25 at 11:16 -0800, Daniel Walker wrote:
> On Tue, 2011-01-25 at 11:14 -0800, David Brown wrote:
> > On Tue, Jan 25 2011, Daniel Walker wrote:
> > 
> > > On Tue, 2011-01-25 at 14:45 +0100, Tejun Heo wrote:
> > >> On Mon, Jan 03, 2011 at 10:10:45AM -0800, Daniel Walker wrote:
> > >> > On Mon, 2011-01-03 at 18:06 +0100, Stanislaw Gruszka wrote:
> > >> > > On Mon, Jan 03, 2011 at 02:49:43PM +0100, Tejun Heo wrote:
> > >> > > > With cmwq, there's no reason to use separate workqueues.  Drop
> > >> > > > msmfb_info->resume_workqueue and use system_wq instead.
> > >> > > > 
> > >> > > > Signed-off-by: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> > >> > > > Cc: Stanislaw Gruszka <stf_xl-5tc4TXWwyLM@public.gmane.org>
> > >> > > I'm not the right person, CC according to MAINTAINERS
> > >> > 
> > >> > ARM/QUALCOMM MSM MACHINE SUPPORT
> > >> > M:      David Brown <davidb-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
> > >> > M:      Daniel Walker <dwalker-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
> > >> > M:      Bryan Huntsman <bryanh-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
> > >> 
> > >> Oops, sorry about that.  So how does the patch look?  Are you gonna
> > >> take it through msm tree or shall I take it?
> > >
> > > David ?
> > >
> > > Daniel
> > 
> > Is it difficult for you to test this change, Daniel?  I can pull it in
> > once we verify it still works.
> 
> Carl V. can test it, and review it I think ..
> 
> Daniel

Tested booting on MSM7X00A; appears to work fine (all I checked was that
it arrived at a buildroot login prompt).

Carl V.

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 20/32] video/msm_fb: use system_wq instead of dedicated workqueues
@ 2011-01-25 22:08                           ` Carl Vanderlip
  0 siblings, 0 replies; 119+ messages in thread
From: Carl Vanderlip @ 2011-01-25 22:08 UTC (permalink / raw)
  To: Daniel Walker
  Cc: David Brown, Tejun Heo, Stanislaw Gruszka, linux-kernel,
	Stanislaw Gruszka, linux-usb, Bryan Huntsman, linux-arm-msm

On Tue, 2011-01-25 at 11:16 -0800, Daniel Walker wrote:
> On Tue, 2011-01-25 at 11:14 -0800, David Brown wrote:
> > On Tue, Jan 25 2011, Daniel Walker wrote:
> > 
> > > On Tue, 2011-01-25 at 14:45 +0100, Tejun Heo wrote:
> > >> On Mon, Jan 03, 2011 at 10:10:45AM -0800, Daniel Walker wrote:
> > >> > On Mon, 2011-01-03 at 18:06 +0100, Stanislaw Gruszka wrote:
> > >> > > On Mon, Jan 03, 2011 at 02:49:43PM +0100, Tejun Heo wrote:
> > >> > > > With cmwq, there's no reason to use separate workqueues.  Drop
> > >> > > > msmfb_info->resume_workqueue and use system_wq instead.
> > >> > > > 
> > >> > > > Signed-off-by: Tejun Heo <tj@kernel.org>
> > >> > > > Cc: Stanislaw Gruszka <stf_xl@wp.pl>
> > >> > > I'm not the right person, CC according to MAINTAINERS
> > >> > 
> > >> > ARM/QUALCOMM MSM MACHINE SUPPORT
> > >> > M:      David Brown <davidb@codeaurora.org>
> > >> > M:      Daniel Walker <dwalker@codeaurora.org>
> > >> > M:      Bryan Huntsman <bryanh@codeaurora.org>
> > >> 
> > >> Oops, sorry about that.  So how does the patch look?  Are you gonna
> > >> take it through msm tree or shall I take it?
> > >
> > > David ?
> > >
> > > Daniel
> > 
> > Is it difficult for you to test this change, Daniel?  I can pull it in
> > once we verify it still works.
> 
> Carl V. can test it, and review it I think ..
> 
> Daniel

Tested booting on MSM7X00A; appears to work fine (all I checked was that
it arrived at a buildroot login prompt).

Carl V.

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.


^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 20/32] video/msm_fb: use system_wq instead of dedicated workqueues
  2011-01-03 13:49 ` [PATCH 20/32] video/msm_fb: " Tejun Heo
       [not found]   ` <1294062595-30097-21-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2011-01-25 23:21   ` David Brown
  2011-01-26 10:41     ` Tejun Heo
  1 sibling, 1 reply; 119+ messages in thread
From: David Brown @ 2011-01-25 23:21 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-kernel, Stanislaw Gruszka, linux-usb, linux-arm-msm

On Mon, Jan 03 2011, Tejun Heo wrote:

> With cmwq, there's no reason to use separate workqueues.  Drop
> msmfb_info->resume_workqueue and use system_wq instead.
>
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: Stanislaw Gruszka <stf_xl@wp.pl>
> Cc: linux-usb@vger.kernel.org
> ---
> Only compile tested.  Please feel free to take it into the subsystem
> tree or simply ack - I'll route it through the wq tree.

I'll pull this into the MSM tree.

Thanks,
David

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCHSET] workqueue: update workqueue users - replace create_workqueue()
  2011-01-25 14:29 ` [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
  2011-01-25 16:26   ` Dave Jones
  2011-01-25 17:47   ` Madhu Iyengar
@ 2011-01-26  4:46   ` Greg KH
  2011-02-01 10:44   ` Tejun Heo
  3 siblings, 0 replies; 119+ messages in thread
From: Greg KH @ 2011-01-26  4:46 UTC (permalink / raw)
  To: Tejun Heo
  Cc: linux-kernel, lenb, linux-acpi, davej, cpufreq, Markus.Lidel,
	tomas.winkler, jayamohank, andrew.vasquez, James.Bottomley,
	linux-scsi, tomof, stf_xl, linux-usb, tytso, mfasheh,
	joel.becker, reiserfs-devel, aelder, hch, ericvh, rminnich,
	v9fs-developer, lucho, andy.grover

On Tue, Jan 25, 2011 at 03:29:21PM +0100, Tejun Heo wrote:
> Hello,
> 
> There was no response for the following patches and I'm planning on
> routing them through workqueue#for-2.6.39.  If you have an objection
> or want to take the patch through a different tree, please let me
> know.
> 
>  0019-usb-ueagle-atm-use-system_wq-instead-of-dedicated-wo.patch

I've already taken this in my usb-next tree to go into .39.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCHSET] workqueue: update workqueue users - replace create_workqueue()
  2011-01-25 16:26   ` Dave Jones
@ 2011-01-26 10:40     ` Tejun Heo
  0 siblings, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-26 10:40 UTC (permalink / raw)
  To: Dave Jones, linux-kernel, lenb, linux-acpi, cpufreq

On Tue, Jan 25, 2011 at 11:26:54AM -0500, Dave Jones wrote:
> On Tue, Jan 25, 2011 at 03:29:21PM +0100, Tejun Heo wrote:
>  > Hello,
>  > 
>  > There was no response for the following patches and I'm planning on
>  > routing them through workqueue#for-2.6.39.  If you have an objection
>  > or want to take the patch through a different tree, please let me
>  > know.
>  > ..
>  >  0007-cpufreq-use-system_wq-instead-of-dedicated-workqueue.patch
> 
> Feel free to add my 
> Signed-off-by: Dave Jones <davej@redhat.com> 
> to this.
> 
> I looked it over, and didn't see anything objectionable.

As the patch is going through wq tree, I added Acked-by instead of
Signed-off-by.

Thank you.

-- 
tejun

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 20/32] video/msm_fb: use system_wq instead of dedicated workqueues
  2011-01-25 23:21   ` David Brown
@ 2011-01-26 10:41     ` Tejun Heo
  2011-01-26 18:04       ` David Brown
  0 siblings, 1 reply; 119+ messages in thread
From: Tejun Heo @ 2011-01-26 10:41 UTC (permalink / raw)
  To: David Brown; +Cc: linux-kernel, Stanislaw Gruszka, linux-usb, linux-arm-msm

On Tue, Jan 25, 2011 at 03:21:31PM -0800, David Brown wrote:
> On Mon, Jan 03 2011, Tejun Heo wrote:
> 
> > With cmwq, there's no reason to use separate workqueues.  Drop
> > msmfb_info->resume_workqueue and use system_wq instead.
> >
> > Signed-off-by: Tejun Heo <tj@kernel.org>
> > Cc: Stanislaw Gruszka <stf_xl@wp.pl>
> > Cc: linux-usb@vger.kernel.org
> > ---
> > Only compile tested.  Please feel free to take it into the subsystem
> > tree or simply ack - I'll route it through the wq tree.
> 
> I'll pull this into the MSM tree.

I suppose it will show up in linux-next?  I'm planning on marking
flush_scheduled_work() deprecated there soonish, so...

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 10/32] input/tps6507x-ts: use system_wq instead of dedicated workqueue
  2011-01-25 16:50           ` Dmitry Torokhov
@ 2011-01-26 10:43             ` Tejun Heo
  0 siblings, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-26 10:43 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Todd Fischer, Dan Carpenter, linux-kernel, linux-input

On Tue, Jan 25, 2011 at 08:50:06AM -0800, Dmitry Torokhov wrote:
> On Tue, Jan 25, 2011 at 09:13:45AM -0700, Todd Fischer wrote:
> > On 01/25/2011 07:19 AM, Tejun Heo wrote:
> > >Shall I apply the patch?
> > >Thanks
> > Yes, apply the patch.  I am not sure of the syntax for attaching my
> > sign off.  Hope this is okay.
> > 
> > Todd
> > 
> > Signed-off-by: Todd Fischer<todd.fischer@ridgerun.com>
> > 
> 
> That should be Acked-by since you are not passing the patch along.

Added ack-by's of Todd and you.  Thank you.

-- 
tejun

^ permalink raw reply	[flat|nested] 119+ messages in thread

* [PATCH UPDATED 21/32] fs/aio: aio_wq isn't used in memory reclaim path
  2011-01-03 13:49 ` [PATCH 21/32] fs/aio: aio_wq isn't used in memory reclaim path Tejun Heo
  2011-01-04 15:56   ` Jeff Moyer
@ 2011-01-26 11:21   ` Tejun Heo
  2011-01-26 16:29     ` Jeff Moyer
  1 sibling, 1 reply; 119+ messages in thread
From: Tejun Heo @ 2011-01-26 11:21 UTC (permalink / raw)
  To: linux-kernel; +Cc: Benjamin LaHaise, linux-aio

aio_wq isn't used during memory reclaim.  Convert to alloc_workqueue()
without WQ_MEM_RECLAIM.  It's possible to use system_wq but given that
the number of work items is determined from userland and the work item
may block, enforcing strict concurrency limit would be a good idea.

Also, move fput_work to system_wq so that aio_wq is used soley to
throttle the max concurrency of aio work items and fput_work doesn't
interact with other work items.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Benjamin LaHaise <bcrl@kvack.org>
Cc: Jeff Moyer <jmoyer@redhat.com>
Cc: linux-aio@kvack.org
---
Patch description updated to describe fput_work change.  If there's no
further objection, I'll push it through workqueue#for-2.6.39.  Thanks.

 fs/aio.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: work/fs/aio.c
===================================================================
--- work.orig/fs/aio.c
+++ work/fs/aio.c
@@ -85,7 +85,7 @@ static int __init aio_setup(void)
 	kiocb_cachep = KMEM_CACHE(kiocb, SLAB_HWCACHE_ALIGN|SLAB_PANIC);
 	kioctx_cachep = KMEM_CACHE(kioctx,SLAB_HWCACHE_ALIGN|SLAB_PANIC);
 
-	aio_wq = create_workqueue("aio");
+	aio_wq = alloc_workqueue("aio", 0, 1);	/* used to limit concurrency */
 	abe_pool = mempool_create_kmalloc_pool(1, sizeof(struct aio_batch_entry));
 	BUG_ON(!aio_wq || !abe_pool);
 
@@ -569,7 +569,7 @@ static int __aio_put_req(struct kioctx *
 		spin_lock(&fput_lock);
 		list_add(&req->ki_list, &fput_head);
 		spin_unlock(&fput_lock);
-		queue_work(aio_wq, &fput_work);
+		schedule_work(&fput_work);
 	} else {
 		req->ki_filp = NULL;
 		really_put_req(ctx, req);

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH UPDATED 21/32] fs/aio: aio_wq isn't used in memory reclaim path
  2011-01-26 11:21   ` [PATCH UPDATED " Tejun Heo
@ 2011-01-26 16:29     ` Jeff Moyer
  2011-01-26 16:38       ` Tejun Heo
  0 siblings, 1 reply; 119+ messages in thread
From: Jeff Moyer @ 2011-01-26 16:29 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-kernel, Benjamin LaHaise, linux-aio

Tejun Heo <tj@kernel.org> writes:

> aio_wq isn't used during memory reclaim.  Convert to alloc_workqueue()
> without WQ_MEM_RECLAIM.  It's possible to use system_wq but given that
> the number of work items is determined from userland and the work item
> may block, enforcing strict concurrency limit would be a good idea.
>
> Also, move fput_work to system_wq so that aio_wq is used soley to
> throttle the max concurrency of aio work items and fput_work doesn't
> interact with other work items.
>
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: Benjamin LaHaise <bcrl@kvack.org>
> Cc: Jeff Moyer <jmoyer@redhat.com>

You actually missed that CC.  ;-)

> Cc: linux-aio@kvack.org
> ---
> Patch description updated to describe fput_work change.  If there's no
> further objection, I'll push it through workqueue#for-2.6.39.  Thanks.

Looks good to me, based on not changing existing semantics.

Acked-by: Jeff Moyer <jmoyer@redhat.com>

Cheers,
Jeff

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH UPDATED 21/32] fs/aio: aio_wq isn't used in memory reclaim path
  2011-01-26 16:29     ` Jeff Moyer
@ 2011-01-26 16:38       ` Tejun Heo
  0 siblings, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-01-26 16:38 UTC (permalink / raw)
  To: Jeff Moyer; +Cc: linux-kernel, Benjamin LaHaise, linux-aio

On Wed, Jan 26, 2011 at 11:29:36AM -0500, Jeff Moyer wrote:
> > Signed-off-by: Tejun Heo <tj@kernel.org>
> > Cc: Benjamin LaHaise <bcrl@kvack.org>
> > Cc: Jeff Moyer <jmoyer@redhat.com>
> 
> You actually missed that CC.  ;-)

Oops, sorry about that.

> > Cc: linux-aio@kvack.org
> > ---
> > Patch description updated to describe fput_work change.  If there's no
> > further objection, I'll push it through workqueue#for-2.6.39.  Thanks.
> 
> Looks good to me, based on not changing existing semantics.
> 
> Acked-by: Jeff Moyer <jmoyer@redhat.com>

Thanks.  Applying to workqueue tree w/ acked by added.

-- 
tejun

^ permalink raw reply	[flat|nested] 119+ messages in thread

* [PATCH UPDATED 08/32] drm/nouveau: use system_wq instead of dev_priv->wq
  2011-01-06 17:29       ` Tejun Heo
@ 2011-01-26 16:49         ` Tejun Heo
  2011-02-01 10:41           ` Tejun Heo
  0 siblings, 1 reply; 119+ messages in thread
From: Tejun Heo @ 2011-01-26 16:49 UTC (permalink / raw)
  To: Ben Skeggs; +Cc: linux-kernel, dri-devel

With cmwq, there's no reason for nouveau to use a dedicated workqueue.
Drop dev_priv->wq and use system_wq instead.  Each work item is sync
flushed when the containing structure is unregistered/destroyed.

Note that this change also makes sure that nv50_gpio_handler is not
freed while the contained work item is still running.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
---
Here's a patch on top of the current linus#master.  It's much simpler
than before.  The only concern is that it adds flush_work_sync() call
which might sleep to unregistration paths.  AFAICS, this seems safe,
right?  If this looks okay to you, please feel free to route it
through the drm tree.

Thank you.

 drivers/gpu/drm/nouveau/nouveau_drv.h   |    1 -
 drivers/gpu/drm/nouveau/nouveau_state.c |   10 +---------
 drivers/gpu/drm/nouveau/nv50_display.c  |    5 ++++-
 drivers/gpu/drm/nouveau/nv50_gpio.c     |   11 ++++++++---
 4 files changed, 13 insertions(+), 14 deletions(-)

Index: work/drivers/gpu/drm/nouveau/nouveau_drv.h
===================================================================
--- work.orig/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ work/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -652,7 +652,6 @@ struct drm_nouveau_private {
 	/* interrupt handling */
 	void (*irq_handler[32])(struct drm_device *);
 	bool msi_enabled;
-	struct workqueue_struct *wq;
 	struct work_struct irq_work;
 
 	struct list_head vbl_waiting;
Index: work/drivers/gpu/drm/nouveau/nouveau_state.c
===================================================================
--- work.orig/drivers/gpu/drm/nouveau/nouveau_state.c
+++ work/drivers/gpu/drm/nouveau/nouveau_state.c
@@ -929,12 +929,6 @@ int nouveau_load(struct drm_device *dev,
 	NV_DEBUG(dev, "vendor: 0x%X device: 0x%X class: 0x%X\n",
 		 dev->pci_vendor, dev->pci_device, dev->pdev->class);
 
-	dev_priv->wq = create_workqueue("nouveau");
-	if (!dev_priv->wq) {
-		ret = -EINVAL;
-		goto err_priv;
-	}
-
 	/* resource 0 is mmio regs */
 	/* resource 1 is linear FB */
 	/* resource 2 is RAMIN (mmio regs + 0x1000000) */
@@ -947,7 +941,7 @@ int nouveau_load(struct drm_device *dev,
 		NV_ERROR(dev, "Unable to initialize the mmio mapping. "
 			 "Please report your setup to " DRIVER_EMAIL "\n");
 		ret = -EINVAL;
-		goto err_wq;
+		goto err_priv;
 	}
 	NV_DEBUG(dev, "regs mapped ok at 0x%llx\n",
 					(unsigned long long)mmio_start_offs);
@@ -1054,8 +1048,6 @@ err_ramin:
 	iounmap(dev_priv->ramin);
 err_mmio:
 	iounmap(dev_priv->mmio);
-err_wq:
-	destroy_workqueue(dev_priv->wq);
 err_priv:
 	kfree(dev_priv);
 	dev->dev_private = NULL;
Index: work/drivers/gpu/drm/nouveau/nv50_display.c
===================================================================
--- work.orig/drivers/gpu/drm/nouveau/nv50_display.c
+++ work/drivers/gpu/drm/nouveau/nv50_display.c
@@ -345,12 +345,15 @@ int nv50_display_create(struct drm_devic
 void
 nv50_display_destroy(struct drm_device *dev)
 {
+	struct drm_nouveau_private *dev_priv = dev->dev_private;
+
 	NV_DEBUG_KMS(dev, "\n");
 
 	drm_mode_config_cleanup(dev);
 
 	nv50_display_disable(dev);
 	nouveau_irq_unregister(dev, 26);
+	flush_work_sync(&dev_priv->irq_work);
 }
 
 static u16
@@ -836,7 +839,7 @@ nv50_display_isr(struct drm_device *dev)
 		if (clock) {
 			nv_wr32(dev, NV03_PMC_INTR_EN_0, 0);
 			if (!work_pending(&dev_priv->irq_work))
-				queue_work(dev_priv->wq, &dev_priv->irq_work);
+				schedule_work(&dev_priv->irq_work);
 			delayed |= clock;
 			intr1 &= ~clock;
 		}
Index: work/drivers/gpu/drm/nouveau/nv50_gpio.c
===================================================================
--- work.orig/drivers/gpu/drm/nouveau/nv50_gpio.c
+++ work/drivers/gpu/drm/nouveau/nv50_gpio.c
@@ -137,6 +137,7 @@ nv50_gpio_irq_unregister(struct drm_devi
 	struct nv50_gpio_priv *priv = pgpio->priv;
 	struct nv50_gpio_handler *gpioh, *tmp;
 	struct dcb_gpio_entry *gpio;
+	LIST_HEAD(tofree);
 	unsigned long flags;
 
 	gpio = nouveau_bios_gpio_entry(dev, tag);
@@ -149,10 +150,14 @@ nv50_gpio_irq_unregister(struct drm_devi
 		    gpioh->handler != handler ||
 		    gpioh->data != data)
 			continue;
-		list_del(&gpioh->head);
-		kfree(gpioh);
+		list_move(&gpioh->head, &tofree);
 	}
 	spin_unlock_irqrestore(&priv->lock, flags);
+
+	list_for_each_entry_safe(gpioh, tmp, &tofree, head) {
+		flush_work_sync(&gpioh->work);
+		kfree(gpioh);
+	}
 }
 
 bool
@@ -293,7 +298,7 @@ nv50_gpio_isr(struct drm_device *dev)
 			continue;
 		gpioh->inhibit = true;
 
-		queue_work(dev_priv->wq, &gpioh->work);
+		schedule_work(&gpioh->work);
 	}
 	spin_unlock(&priv->lock);
 }

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 20/32] video/msm_fb: use system_wq instead of dedicated workqueues
  2011-01-26 10:41     ` Tejun Heo
@ 2011-01-26 18:04       ` David Brown
  0 siblings, 0 replies; 119+ messages in thread
From: David Brown @ 2011-01-26 18:04 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-kernel, Stanislaw Gruszka, linux-usb, linux-arm-msm

On Wed, Jan 26 2011, Tejun Heo wrote:

> On Tue, Jan 25, 2011 at 03:21:31PM -0800, David Brown wrote:

> I suppose it will show up in linux-next?  I'm planning on marking
> flush_scheduled_work() deprecated there soonish, so...

Hmm, it should be there.  Well, it will at least be there when the next
linux-next tree comes out.

David

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 17/32] scsi/ibmvstgt: use system_wq instead of vtgtd workqueue
  2011-01-24 16:24     ` Tejun Heo
@ 2011-02-01 10:40       ` Tejun Heo
  2011-02-01 14:18         ` FUJITA Tomonori
  0 siblings, 1 reply; 119+ messages in thread
From: Tejun Heo @ 2011-02-01 10:40 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: linux-kernel, FUJITA Tomonori, James E.J. Bottomley, linux-scsi,
	Brian King, Robert Jennings

On Mon, Jan 24, 2011 at 05:24:14PM +0100, Tejun Heo wrote:
> Hello,
> 
> On Mon, Jan 24, 2011 at 05:09:18PM +0100, Bart Van Assche wrote:
> > Insertion of  flush_work_sync() fixes a race - that's a good catch.
> > flush_work_sync() should be invoked a little earlier though because
> > the scheduled work may access the queue destroyed by the
> > crq_queue_destroy(target) call. And the CRQ interrupt should be
> > disabled from before flush_work_sync() is invoked until after the CRQ
> > has been destroyed.
> 
> Heh, I'm a bit out of my depth here.  If you know what's necessary,
> please go ahead and make the change.
> 
> > Regarding the queue removal: I might have missed something, but why
> > would you like to remove the vtgtd work queue ? Since the ibmvstgt
> > driver is a storage target driver, processing latency matters. I'm
> > afraid that switching from a dedicated queue to the global work queue
> > will increase processing latency.
> 
> Having a dedicated workqueue no longer makes any difference regarding
> processing latency.  Each workqueue is mere frontend to the shared
> worker pool anyway.  Dedicated workqueues are now meaningful only as
> forward progress guarantee, attribute and/or flush domain - IOW, when
> the workqueue needs to be used during memory reclaim, the work items
> need to have specific attributes or certain group of work items need
> to be flushed together.  Apart from that, there's virtually no
> difference between using the system_wq and a dedicated one.  As using
> the system one is usually simpler, it's natural to do that.

Ping.  Are you interested in doing the conversion?

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH UPDATED 08/32] drm/nouveau: use system_wq instead of dev_priv->wq
  2011-01-26 16:49         ` [PATCH UPDATED " Tejun Heo
@ 2011-02-01 10:41           ` Tejun Heo
  2011-02-04  1:53             ` Ben Skeggs
  0 siblings, 1 reply; 119+ messages in thread
From: Tejun Heo @ 2011-02-01 10:41 UTC (permalink / raw)
  To: Ben Skeggs; +Cc: linux-kernel, dri-devel

On Wed, Jan 26, 2011 at 05:49:18PM +0100, Tejun Heo wrote:
> With cmwq, there's no reason for nouveau to use a dedicated workqueue.
> Drop dev_priv->wq and use system_wq instead.  Each work item is sync
> flushed when the containing structure is unregistered/destroyed.
> 
> Note that this change also makes sure that nv50_gpio_handler is not
> freed while the contained work item is still running.
> 
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: David Airlie <airlied@linux.ie>
> Cc: dri-devel@lists.freedesktop.org

Ping.  Can you please put this through the drm tree?

Thank you.

-- 
tejun

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCHSET] workqueue: update workqueue users - replace create_workqueue()
  2011-01-25 14:29 ` [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
                     ` (2 preceding siblings ...)
  2011-01-26  4:46   ` Greg KH
@ 2011-02-01 10:44   ` Tejun Heo
  3 siblings, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-02-01 10:44 UTC (permalink / raw)
  To: linux-kernel
  Cc: lenb, linux-acpi, davej, cpufreq, Markus.Lidel, tomas.winkler,
	jayamohank, andrew.vasquez, James.Bottomley, linux-scsi, tomof,
	stf_xl, linux-usb, tytso, mfasheh, joel.becker, reiserfs-devel,
	aelder, hch, ericvh, rminnich, v9fs-developer, lucho,
	andy.grover

On Tue, Jan 25, 2011 at 03:29:21PM +0100, Tejun Heo wrote:
> Hello,
> 
> There was no response for the following patches and I'm planning on
> routing them through workqueue#for-2.6.39.  If you have an objection
> or want to take the patch through a different tree, please let me
> know.
> 
>  0006-acpi-kacpi-_wq-don-t-need-WQ_MEM_RECLAIM.patch
>  0007-cpufreq-use-system_wq-instead-of-dedicated-workqueue.patch
>  0012-i2o-use-alloc_workqueue-instead-of-create_workqueue.patch
>  0013-misc-iwmc3200top-use-system_wq-instead-of-dedicated-.patch
>  0016-scsi-be2iscsi-qla2xxx-convert-to-alloc_workqueue.patch
>  0018-scsi-scsi_tgt_lib-scsi_tgtd-isn-t-used-in-memory-rec.patch
>  0019-usb-ueagle-atm-use-system_wq-instead-of-dedicated-wo.patch
>  0025-ext4-convert-to-alloc_workqueue.patch
>  0026-ocfs2-use-system_wq-instead-of-ocfs2_quota_wq.patch
>  0027-reiserfs-make-commit_wq-use-the-default-concurrency-.patch
>  0028-xfs-convert-to-alloc_workqueue.patch
>  0029-net-9p-use-system_wq-instead-of-p9_mux_wq.patch
>  0030-net-9p-replace-p9_poll_task-with-a-work.patch
>  0031-rds-ib-use-system_wq-instead-of-rds_ib_fmr_wq.patch

Patches applied to wq#for-2.6.39 w/ collected acks added.

Thank you.

-- 
tejun

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 15/32] wireless/libertas[_tf]: use system_wq instead of dedicated workqueues
  2011-01-03 13:49 ` [PATCH 15/32] wireless/libertas[_tf]: " Tejun Heo
@ 2011-02-01 10:52   ` Tejun Heo
  0 siblings, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-02-01 10:52 UTC (permalink / raw)
  To: linux-kernel; +Cc: Dan Williams, libertas-dev

On Mon, Jan 03, 2011 at 02:49:38PM +0100, Tejun Heo wrote:
> With cmwq, there's no reason to use separate workqueues in
> libertas[_tf] drivers.  Drop them and use system_wq instead.  All used
> work items are sync flushed/canceled on driver detach.
> 
> Cc: Dan Williams <dcbw@redhat.com>
> Cc: libertas-dev@lists.infradead.org
> ---
> Only compile tested.  Please feel free to take it into the subsystem
> tree or simply ack - I'll route it through the wq tree.

Dan, ping?

-- 
tejun

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 17/32] scsi/ibmvstgt: use system_wq instead of vtgtd workqueue
  2011-02-01 10:40       ` Tejun Heo
@ 2011-02-01 14:18         ` FUJITA Tomonori
  2011-02-01 14:25           ` James Bottomley
  2011-02-01 14:29           ` Tejun Heo
  0 siblings, 2 replies; 119+ messages in thread
From: FUJITA Tomonori @ 2011-02-01 14:18 UTC (permalink / raw)
  To: tj
  Cc: bvanassche, linux-kernel, fujita.tomonori, James.Bottomley,
	linux-scsi, brking, rcj

On Tue, 1 Feb 2011 11:40:43 +0100
Tejun Heo <tj@kernel.org> wrote:

> On Mon, Jan 24, 2011 at 05:24:14PM +0100, Tejun Heo wrote:
> > Hello,
> > 
> > On Mon, Jan 24, 2011 at 05:09:18PM +0100, Bart Van Assche wrote:
> > > Insertion of  flush_work_sync() fixes a race - that's a good catch.
> > > flush_work_sync() should be invoked a little earlier though because
> > > the scheduled work may access the queue destroyed by the
> > > crq_queue_destroy(target) call. And the CRQ interrupt should be
> > > disabled from before flush_work_sync() is invoked until after the CRQ
> > > has been destroyed.
> > 
> > Heh, I'm a bit out of my depth here.  If you know what's necessary,
> > please go ahead and make the change.
> > 
> > > Regarding the queue removal: I might have missed something, but why
> > > would you like to remove the vtgtd work queue ? Since the ibmvstgt
> > > driver is a storage target driver, processing latency matters. I'm
> > > afraid that switching from a dedicated queue to the global work queue
> > > will increase processing latency.
> > 
> > Having a dedicated workqueue no longer makes any difference regarding
> > processing latency.  Each workqueue is mere frontend to the shared
> > worker pool anyway.  Dedicated workqueues are now meaningful only as
> > forward progress guarantee, attribute and/or flush domain - IOW, when
> > the workqueue needs to be used during memory reclaim, the work items
> > need to have specific attributes or certain group of work items need
> > to be flushed together.  Apart from that, there's virtually no
> > difference between using the system_wq and a dedicated one.  As using
> > the system one is usually simpler, it's natural to do that.
> 
> Ping.  Are you interested in doing the conversion?

FYI, this driver will be replaced shortly. Now I have the working
ibmvscsis driver for the new target framework. I'll submit it this
week. So this driver will be removed soon or later (if James prefer to
go through the proper Documentation/feature-removal-schedule.txt
process, it'll be for some time). You could leave this alone, I guess.

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 17/32] scsi/ibmvstgt: use system_wq instead of vtgtd workqueue
  2011-02-01 14:18         ` FUJITA Tomonori
@ 2011-02-01 14:25           ` James Bottomley
  2011-02-01 14:29           ` Tejun Heo
  1 sibling, 0 replies; 119+ messages in thread
From: James Bottomley @ 2011-02-01 14:25 UTC (permalink / raw)
  To: FUJITA Tomonori; +Cc: tj, bvanassche, linux-kernel, linux-scsi, brking, rcj

On Tue, 2011-02-01 at 23:18 +0900, FUJITA Tomonori wrote:
> On Tue, 1 Feb 2011 11:40:43 +0100
> Tejun Heo <tj@kernel.org> wrote:
> 
> > On Mon, Jan 24, 2011 at 05:24:14PM +0100, Tejun Heo wrote:
> > > Hello,
> > > 
> > > On Mon, Jan 24, 2011 at 05:09:18PM +0100, Bart Van Assche wrote:
> > > > Insertion of  flush_work_sync() fixes a race - that's a good catch.
> > > > flush_work_sync() should be invoked a little earlier though because
> > > > the scheduled work may access the queue destroyed by the
> > > > crq_queue_destroy(target) call. And the CRQ interrupt should be
> > > > disabled from before flush_work_sync() is invoked until after the CRQ
> > > > has been destroyed.
> > > 
> > > Heh, I'm a bit out of my depth here.  If you know what's necessary,
> > > please go ahead and make the change.
> > > 
> > > > Regarding the queue removal: I might have missed something, but why
> > > > would you like to remove the vtgtd work queue ? Since the ibmvstgt
> > > > driver is a storage target driver, processing latency matters. I'm
> > > > afraid that switching from a dedicated queue to the global work queue
> > > > will increase processing latency.
> > > 
> > > Having a dedicated workqueue no longer makes any difference regarding
> > > processing latency.  Each workqueue is mere frontend to the shared
> > > worker pool anyway.  Dedicated workqueues are now meaningful only as
> > > forward progress guarantee, attribute and/or flush domain - IOW, when
> > > the workqueue needs to be used during memory reclaim, the work items
> > > need to have specific attributes or certain group of work items need
> > > to be flushed together.  Apart from that, there's virtually no
> > > difference between using the system_wq and a dedicated one.  As using
> > > the system one is usually simpler, it's natural to do that.
> > 
> > Ping.  Are you interested in doing the conversion?
> 
> FYI, this driver will be replaced shortly. Now I have the working
> ibmvscsis driver for the new target framework. I'll submit it this
> week. So this driver will be removed soon or later (if James prefer to
> go through the proper Documentation/feature-removal-schedule.txt
> process, it'll be for some time). You could leave this alone, I guess.

Whatever works for you is fine by me.  I don't think we need to go
through feature removal since we're not technically removing the
feature.

James



^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 17/32] scsi/ibmvstgt: use system_wq instead of vtgtd workqueue
  2011-02-01 14:18         ` FUJITA Tomonori
  2011-02-01 14:25           ` James Bottomley
@ 2011-02-01 14:29           ` Tejun Heo
  1 sibling, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-02-01 14:29 UTC (permalink / raw)
  To: FUJITA Tomonori
  Cc: bvanassche, linux-kernel, James.Bottomley, linux-scsi, brking, rcj

On Tue, Feb 01, 2011 at 11:18:54PM +0900, FUJITA Tomonori wrote:
> > Ping.  Are you interested in doing the conversion?
> 
> FYI, this driver will be replaced shortly. Now I have the working
> ibmvscsis driver for the new target framework. I'll submit it this
> week. So this driver will be removed soon or later (if James prefer to
> go through the proper Documentation/feature-removal-schedule.txt
> process, it'll be for some time). You could leave this alone, I guess.

I see.  I'll drop the patch then.  Please keep in mind that I'm
planning on marking flush_scheduled_work() deprecated in linux-next in
a month or so.  create_singlethread_workqueue() will follow in the
next cycle and then create_workqueue() the next.

Thank you.

-- 
tejun

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 16/32] scsi/be2iscsi,qla2xxx: convert to alloc_workqueue()
  2011-01-03 13:49 ` [PATCH 16/32] scsi/be2iscsi,qla2xxx: convert to alloc_workqueue() Tejun Heo
@ 2011-02-01 23:45   ` Mike Christie
  2011-02-02 10:25     ` Tejun Heo
  0 siblings, 1 reply; 119+ messages in thread
From: Mike Christie @ 2011-02-01 23:45 UTC (permalink / raw)
  To: Tejun Heo
  Cc: linux-kernel, Jayamohan Kallickal, Andrew Vasquez,
	James E.J. Bottomley, linux-scsi

On 01/03/2011 07:49 AM, Tejun Heo wrote:
> diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
> index 75a85aa..4339196 100644
> --- a/drivers/scsi/be2iscsi/be_main.c
> +++ b/drivers/scsi/be2iscsi/be_main.c
> @@ -4276,7 +4276,7 @@ static int __devinit beiscsi_dev_probe(struct pci_dev *pcidev,
>
>   	snprintf(phba->wq_name, sizeof(phba->wq_name), "beiscsi_q_irq%u",
>   		 phba->shost->host_no);
> -	phba->wq = create_workqueue(phba->wq_name);
> +	phba->wq = alloc_workqueue(phba->wq_name, WQ_MEM_RECLAIM, 1);
>   	if (!phba->wq) {
>   		shost_printk(KERN_ERR, phba->shost, "beiscsi_dev_probe-"
>   				"Failed to allocate work queue\n");
> diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
> index 2c0876c..2cd0a77 100644
> --- a/drivers/scsi/qla2xxx/qla_os.c
> +++ b/drivers/scsi/qla2xxx/qla_os.c
> @@ -356,7 +356,7 @@ static int qla25xx_setup_mode(struct scsi_qla_host *vha)
>   				"Can't create request queue\n");
>   			goto fail;
>   		}
> -		ha->wq = create_workqueue("qla2xxx_wq");
> +		ha->wq = alloc_workqueue("qla2xxx_wq", WQ_MEM_RECLAIM, 1);
>   		vha->req = ha->req_q_map[req];
>   		options |= BIT_1;
>   		for (ques = 1; ques<  ha->max_rsp_queues; ques++) {

I think these are used in the main IO path, so would you also want 
WQ_HIGHPRI | WQ_CPU_INTENSIVE to be set? I think qla2xxx was using this 
in a path they expected to have high throughput/low latency, and from 
the interrupt handler they would try to queue the work on the same cpu 
the isr was answered on. With the new workqueue code could you possibly 
get queued onto a workqueue that is doing other work for other drivers?

Should qla2xxx be using the blkiopoll framework instead of a workqueue 
or will workqueues still provide the same performance when setting 
WQ_HIGHPRI | WQ_CPU_INTENSIVE?

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 16/32] scsi/be2iscsi,qla2xxx: convert to alloc_workqueue()
  2011-02-01 23:45   ` Mike Christie
@ 2011-02-02 10:25     ` Tejun Heo
  2011-02-02 20:41       ` Mike Christie
  0 siblings, 1 reply; 119+ messages in thread
From: Tejun Heo @ 2011-02-02 10:25 UTC (permalink / raw)
  To: Mike Christie
  Cc: linux-kernel, Jayamohan Kallickal, Andrew Vasquez,
	James E.J. Bottomley, linux-scsi

Hello,

On Tue, Feb 01, 2011 at 05:45:13PM -0600, Mike Christie wrote:
> I think these are used in the main IO path, so would you also want
> WQ_HIGHPRI | WQ_CPU_INTENSIVE to be set?

Maybe HIGHPRI but definitely not CPU_INTENSIVE, but even HIGHPRI isn't
usually necessary.  The queue of pending works tend to be short and
consumed pretty fast.

> I think qla2xxx was using this in a path they expected to have high
> throughput/low latency, and from the interrupt handler they would
> try to queue the work on the same cpu the isr was answered on. With
> the new workqueue code could you possibly get queued onto a
> workqueue that is doing other work for other drivers?

There are no separate workqueues.  There's one per cpu which is used
by all workqueue users.  HIGHPRI boosts the queueing order in that
queue.

> Should qla2xxx be using the blkiopoll framework instead of a
> workqueue or will workqueues still provide the same performance when
> setting WQ_HIGHPRI | WQ_CPU_INTENSIVE?

CPU_INTENSIVE isn't applicable at all unless you want to run crypto or
zlib from the driver.

blk_iopoll runs off softirq and will always have lower latency than
workqueue which requires scheduling, so it depends on the
requirements.  I guess the best thing would be playing with things a
bit and make decisions on test results.  It shouldn't be too difficult
to switch among them.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 16/32] scsi/be2iscsi,qla2xxx: convert to alloc_workqueue()
  2011-02-02 10:25     ` Tejun Heo
@ 2011-02-02 20:41       ` Mike Christie
  2011-02-03  9:31         ` Tejun Heo
  0 siblings, 1 reply; 119+ messages in thread
From: Mike Christie @ 2011-02-02 20:41 UTC (permalink / raw)
  To: Tejun Heo
  Cc: linux-kernel, Jayamohan Kallickal, Andrew Vasquez,
	James E.J. Bottomley, linux-scsi

On 02/02/2011 04:25 AM, Tejun Heo wrote:
> usually necessary.  The queue of pending works tend to be short and
> consumed pretty fast.
>

What if we want to do something that could take a while, like doing 
recovery of a device/transport (so you have to send resets and 
logouts/logins and wait for the results but they could take a while if 
they timeout), should we be using something other than a workqueue so it 
does not interfere with other users?

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH 16/32] scsi/be2iscsi,qla2xxx: convert to alloc_workqueue()
  2011-02-02 20:41       ` Mike Christie
@ 2011-02-03  9:31         ` Tejun Heo
  0 siblings, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-02-03  9:31 UTC (permalink / raw)
  To: Mike Christie
  Cc: linux-kernel, Jayamohan Kallickal, Andrew Vasquez,
	James E.J. Bottomley, linux-scsi

Hello, Mike.

On Wed, Feb 02, 2011 at 02:41:22PM -0600, Mike Christie wrote:
> On 02/02/2011 04:25 AM, Tejun Heo wrote:
> >usually necessary.  The queue of pending works tend to be short and
> >consumed pretty fast.
> 
> What if we want to do something that could take a while, like doing
> recovery of a device/transport (so you have to send resets and
> logouts/logins and wait for the results but they could take a while
> if they timeout), should we be using something other than a
> workqueue so it does not interfere with other users?

As long as you don't use ordered workqueue, it wouldn't be a problem.
The max concurrency is determined by @max_active parameter to
alloc_workqueue() and workqueue will try to provide concurrency upto
the limit on demand as long as resources are available.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH UPDATED 08/32] drm/nouveau: use system_wq instead of dev_priv->wq
  2011-02-01 10:41           ` Tejun Heo
@ 2011-02-04  1:53             ` Ben Skeggs
  2011-02-04 11:03               ` Tejun Heo
  0 siblings, 1 reply; 119+ messages in thread
From: Ben Skeggs @ 2011-02-04  1:53 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-kernel, dri-devel

On Tue, 2011-02-01 at 11:41 +0100, Tejun Heo wrote:
> On Wed, Jan 26, 2011 at 05:49:18PM +0100, Tejun Heo wrote:
> > With cmwq, there's no reason for nouveau to use a dedicated workqueue.
> > Drop dev_priv->wq and use system_wq instead.  Each work item is sync
> > flushed when the containing structure is unregistered/destroyed.
> > 
> > Note that this change also makes sure that nv50_gpio_handler is not
> > freed while the contained work item is still running.
> > 
> > Signed-off-by: Tejun Heo <tj@kernel.org>
> > Cc: David Airlie <airlied@linux.ie>
> > Cc: dri-devel@lists.freedesktop.org
> 
> Ping.  Can you please put this through the drm tree?
Hey Tejun,

Thanks for this again.  I've just made some changes to the nv50 display
bottom half handling that these will conflict with, they'll hit the
nouveau tree next week.

I'll push the still-relevant bits of your nouveau patch through the
nouveau tree for the 2.6.39-rc1 merge window.  That ok?

Thanks,
Ben.

> 
> Thank you.
> 



^ permalink raw reply	[flat|nested] 119+ messages in thread

* Re: [PATCH UPDATED 08/32] drm/nouveau: use system_wq instead of dev_priv->wq
  2011-02-04  1:53             ` Ben Skeggs
@ 2011-02-04 11:03               ` Tejun Heo
  0 siblings, 0 replies; 119+ messages in thread
From: Tejun Heo @ 2011-02-04 11:03 UTC (permalink / raw)
  To: Ben Skeggs; +Cc: linux-kernel, dri-devel

Hello,

On Fri, Feb 04, 2011 at 11:53:25AM +1000, Ben Skeggs wrote:
> Thanks for this again.  I've just made some changes to the nv50 display
> bottom half handling that these will conflict with, they'll hit the
> nouveau tree next week.

Eh, so it doesn't apply again?  :-)

> I'll push the still-relevant bits of your nouveau patch through the
> nouveau tree for the 2.6.39-rc1 merge window.  That ok?

Yeah, sure, but if you tell me against which tree I should generate
patch, I can also just redo the patch.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 119+ messages in thread

end of thread, other threads:[~2011-02-04 11:04 UTC | newest]

Thread overview: 119+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-03 13:49 [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
2011-01-03 13:49 ` [PATCH 01/32] arm/omap: use system_wq in mailbox Tejun Heo
2011-01-03 21:35   ` Kanigeri, Hari
2011-01-04  5:24     ` Tejun Heo
2011-01-25 13:47       ` Tejun Heo
2011-01-25 15:34         ` Hari Kanigeri
2011-01-25 15:34           ` Hari Kanigeri
2011-01-25 15:37           ` Tejun Heo
2011-01-03 13:49 ` [PATCH 02/32] powerpc/cell: use system_wq in cpufreq_spudemand Tejun Heo
2011-01-03 13:49   ` Tejun Heo
2011-01-03 13:49 ` [PATCH 03/32] block: make kblockd_workqueue smarter Tejun Heo
2011-01-03 14:00   ` Jens Axboe
2011-01-03 13:49 ` [PATCH 04/32] bio-integrity: mark kintegrityd_wq highpri and CPU intensive Tejun Heo
2011-01-03 13:49 ` [PATCH 05/32] crypto: mark crypto workqueues CPU_INTENSIVE Tejun Heo
2011-01-03 13:49   ` Tejun Heo
2011-01-04  4:38   ` Herbert Xu
2011-01-04  4:38     ` Herbert Xu
2011-01-03 13:49 ` [PATCH 06/32] acpi: kacpi*_wq don't need WQ_MEM_RECLAIM Tejun Heo
2011-01-03 13:49 ` [PATCH 07/32] cpufreq: use system_wq instead of dedicated workqueues Tejun Heo
2011-01-03 13:49 ` [PATCH 08/32] drm/nouveau: use system_wq instead of dev_priv->wq Tejun Heo
2011-01-03 13:49   ` Tejun Heo
2011-01-05  1:07   ` Ben Skeggs
2011-01-05  1:16     ` Ben Skeggs
2011-01-06 17:29       ` Tejun Heo
2011-01-26 16:49         ` [PATCH UPDATED " Tejun Heo
2011-02-01 10:41           ` Tejun Heo
2011-02-04  1:53             ` Ben Skeggs
2011-02-04 11:03               ` Tejun Heo
2011-01-03 13:49 ` [PATCH 09/32] drm/radeon: " Tejun Heo
2011-01-03 13:49   ` Tejun Heo
2011-01-05  0:21   ` Alex Deucher
2011-01-06  4:31     ` Dave Airlie
2011-01-03 13:49 ` [PATCH 10/32] input/tps6507x-ts: use system_wq instead of dedicated workqueue Tejun Heo
2011-01-03 14:39   ` Dan Carpenter
2011-01-03 16:34     ` Todd Fischer
2011-01-25 14:19       ` Tejun Heo
2011-01-25 16:13         ` Todd Fischer
2011-01-25 16:50           ` Dmitry Torokhov
2011-01-26 10:43             ` Tejun Heo
2011-01-03 13:49 ` [PATCH 11/32] v4l/cx18: update workqueue usage Tejun Heo
2011-01-04  0:54   ` Andy Walls
2011-01-04  8:36     ` Tejun Heo
2011-01-04 13:21       ` Andy Walls
2011-01-08 17:03   ` Andy Walls
2011-01-03 13:49 ` [PATCH 12/32] i2o: use alloc_workqueue() instead of create_workqueue() Tejun Heo
2011-01-03 13:49 ` [PATCH 13/32] misc/iwmc3200top: use system_wq instead of dedicated workqueues Tejun Heo
2011-01-03 13:49 ` [PATCH 14/32] wireless/ipw2x00: " Tejun Heo
2011-01-06 20:51   ` John W. Linville
2011-01-03 13:49 ` [PATCH 15/32] wireless/libertas[_tf]: " Tejun Heo
2011-02-01 10:52   ` Tejun Heo
2011-01-03 13:49 ` [PATCH 16/32] scsi/be2iscsi,qla2xxx: convert to alloc_workqueue() Tejun Heo
2011-02-01 23:45   ` Mike Christie
2011-02-02 10:25     ` Tejun Heo
2011-02-02 20:41       ` Mike Christie
2011-02-03  9:31         ` Tejun Heo
2011-01-03 13:49 ` [PATCH 17/32] scsi/ibmvstgt: use system_wq instead of vtgtd workqueue Tejun Heo
2011-01-03 17:45   ` Bart Van Assche
2011-01-04  5:20     ` Tejun Heo
2011-01-24 16:09   ` Bart Van Assche
2011-01-24 16:24     ` Tejun Heo
2011-02-01 10:40       ` Tejun Heo
2011-02-01 14:18         ` FUJITA Tomonori
2011-02-01 14:25           ` James Bottomley
2011-02-01 14:29           ` Tejun Heo
2011-01-03 13:49 ` [PATCH 18/32] scsi/scsi_tgt_lib: scsi_tgtd isn't used in memory reclaim path Tejun Heo
2011-01-03 13:49 ` [PATCH 19/32] usb/ueagle-atm: use system_wq instead of dedicated workqueues Tejun Heo
2011-01-03 13:49 ` [PATCH 20/32] video/msm_fb: " Tejun Heo
     [not found]   ` <1294062595-30097-21-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2011-01-03 17:06     ` Stanislaw Gruszka
2011-01-03 17:06       ` Stanislaw Gruszka
     [not found]       ` <20110103170615.GB2285-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2011-01-03 18:10         ` Daniel Walker
2011-01-03 18:10           ` Daniel Walker
     [not found]           ` <1294078245.18295.5.camel-y5Owza0q8UhBVvN7MMdr1KRtKmQZhJ7pQQ4Iyu8u01E@public.gmane.org>
2011-01-25 13:45             ` Tejun Heo
2011-01-25 13:45               ` Tejun Heo
     [not found]               ` <20110125134558.GY27510-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2011-01-25 18:00                 ` Daniel Walker
2011-01-25 18:00                   ` Daniel Walker
2011-01-25 19:14                   ` David Brown
2011-01-25 19:16                     ` Daniel Walker
     [not found]                       ` <1295982976.25496.29.camel-y5Owza0q8UhBVvN7MMdr1KRtKmQZhJ7pQQ4Iyu8u01E@public.gmane.org>
2011-01-25 22:08                         ` Carl Vanderlip
2011-01-25 22:08                           ` Carl Vanderlip
2011-01-25 23:21   ` David Brown
2011-01-26 10:41     ` Tejun Heo
2011-01-26 18:04       ` David Brown
2011-01-03 13:49 ` [PATCH 21/32] fs/aio: aio_wq isn't used in memory reclaim path Tejun Heo
2011-01-04 15:56   ` Jeff Moyer
2011-01-05 11:28     ` Tejun Heo
2011-01-05 14:50       ` Jeff Moyer
2011-01-05 15:00         ` Benjamin LaHaise
2011-01-05 15:49           ` Jeff Moyer
2011-01-26 11:21   ` [PATCH UPDATED " Tejun Heo
2011-01-26 16:29     ` Jeff Moyer
2011-01-26 16:38       ` Tejun Heo
2011-01-03 13:49 ` [PATCH 22/32] ceph: fsc->*_wq's aren't " Tejun Heo
2011-01-03 17:58   ` Sage Weil
2011-01-03 13:49 ` [PATCH 23/32] net/ceph: make ceph_msgr_wq non-reentrant Tejun Heo
2011-01-03 17:58   ` Sage Weil
2011-01-03 13:49 ` [PATCH 24/32] dlm: dlm workqueues aren't used in memory reclaim path Tejun Heo
2011-01-03 13:58   ` Steven Whitehouse
2011-01-03 13:58     ` [Cluster-devel] " Steven Whitehouse
2011-01-03 14:01     ` Tejun Heo
2011-01-03 14:21       ` Steven Whitehouse
2011-01-03 14:21         ` [Cluster-devel] " Steven Whitehouse
2011-01-03 14:27         ` Tejun Heo
2011-01-03 14:39           ` Steven Whitehouse
2011-01-03 14:39             ` [Cluster-devel] " Steven Whitehouse
2011-01-03 14:44             ` Tejun Heo
2011-01-03 13:49 ` [PATCH 25/32] ext4: convert to alloc_workqueue() Tejun Heo
2011-01-03 13:49 ` [PATCH 26/32] ocfs2: use system_wq instead of ocfs2_quota_wq Tejun Heo
2011-01-03 13:49 ` [PATCH 27/32] reiserfs: make commit_wq use the default concurrency level Tejun Heo
2011-01-03 13:49 ` [PATCH 28/32] xfs: convert to alloc_workqueue() Tejun Heo
2011-01-03 13:49 ` [PATCH 29/32] net/9p: use system_wq instead of p9_mux_wq Tejun Heo
2011-01-03 13:49 ` [PATCH 30/32] net/9p: replace p9_poll_task with a work Tejun Heo
2011-01-03 13:49 ` [PATCH 31/32] rds/ib: use system_wq instead of rds_ib_fmr_wq Tejun Heo
2011-01-03 13:49 ` [PATCH 32/32] rxrpc: rxrpc_workqueue isn't used during memory reclaim Tejun Heo
2011-01-25 14:29 ` [PATCHSET] workqueue: update workqueue users - replace create_workqueue() Tejun Heo
2011-01-25 16:26   ` Dave Jones
2011-01-26 10:40     ` Tejun Heo
2011-01-25 17:47   ` Madhu Iyengar
2011-01-26  4:46   ` Greg KH
2011-02-01 10:44   ` Tejun Heo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.