dm: add WQ_PERCPU to alloc_workqueue users
Subsystems (2)
PATCH 1/1 dm: add WQ_PERCPU to alloc_workqueue users
This continues the effort to refactor workqueue APIs, which began with the introduction of new workqueues and a new alloc_workqueue flag in:
commit 128ea9f6ccfb ("workqueue: Add system_percpu_wq and system_dfl_wq") commit 930c2ea566af ("workqueue: Add new WQ_PERCPU flag")
The refactoring is going to alter the default behavior of alloc_workqueue() to be unbound by default.
With the introduction of the WQ_PERCPU flag (equivalent to !WQ_UNBOUND), any alloc_workqueue() caller that doesn’t explicitly specify WQ_UNBOUND must now use WQ_PERCPU. For more details see the Link tag below.
In order to keep alloc_workqueue() behavior identical, explicitly request WQ_PERCPU.
--- drivers/md/dm-bufio.c | 3 ++- drivers/md/dm-cache-target.c | 3 ++- drivers/md/dm-clone-target.c | 3 ++- drivers/md/dm-crypt.c | 6 ++++-- drivers/md/dm-delay.c | 4 +++- drivers/md/dm-integrity.c | 15 ++++++++++----- drivers/md/dm-kcopyd.c | 3 ++- drivers/md/dm-log-userspace-base.c | 3 ++- drivers/md/dm-mpath.c | 5 +++-- drivers/md/dm-raid1.c | 5 +++-- drivers/md/dm-snap-persistent.c | 3 ++- drivers/md/dm-stripe.c | 2 +- drivers/md/dm-verity-target.c | 4 +++- drivers/md/dm-writecache.c | 3 ++- drivers/md/dm.c | 3 ++- drivers/md/md.c | 4 ++-- 16 files changed, 45 insertions(+), 24 deletions(-)
drivers/md/dm-bufio.c +2 -1
@@ -2833,7 +2833,8 @@ static int __init dm_bufio_init(void)__cache_size_refresh ();mutex_unlock (&dm_bufio_clients_lock); - dm_bufio_wq =alloc_workqueue ("dm_bufio_cache" ,WQ_MEM_RECLAIM ,0 ); + dm_bufio_wq =alloc_workqueue ("dm_bufio_cache" , +WQ_MEM_RECLAIM |WQ_PERCPU ,0 );if (!dm_bufio_wq)return -ENOMEM ;
drivers/md/dm-cache-target.c +2 -1
@@ -2533,7 +2533,8 @@ static int cache_create(struct cache_args *ca, struct cache **result) goto bad; } - cache->wq =alloc_workqueue ("dm-" DM_MSG_PREFIX ,WQ_MEM_RECLAIM ,0 ); + cache->wq =alloc_workqueue ("dm-" DM_MSG_PREFIX , +WQ_MEM_RECLAIM |WQ_PERCPU ,0 );if (!cache->wq) { *error ="could not create workqueue for metadata object" ; goto bad;
drivers/md/dm-clone-target.c +2 -1
@@ -1877,7 +1877,8 @@ static int clone_ctr(struct dm_target *ti, unsigned int argc, char **argv) clone->hydration_offset =0 ;atomic_set (&clone->hydrations_in_flight,0 ); - clone->wq =alloc_workqueue ("dm-" DM_MSG_PREFIX ,WQ_MEM_RECLAIM ,0 ); + clone->wq =alloc_workqueue ("dm-" DM_MSG_PREFIX , +WQ_MEM_RECLAIM |WQ_PERCPU ,0 );if (!clone->wq) { ti->error ="Failed to allocate workqueue" ; r = -ENOMEM ;
drivers/md/dm-crypt.c +4 -2
@@ -3400,7 +3400,9 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)if (test_bit (DM_CRYPT_HIGH_PRIORITY , &cc->flags)) common_wq_flags |=WQ_HIGHPRI ; - cc->io_queue =alloc_workqueue ("kcryptd_io-%s-%d" , common_wq_flags,1 , devname, wq_id); + cc->io_queue =alloc_workqueue ("kcryptd_io-%s-%d" , + common_wq_flags |WQ_PERCPU ,1 , + devname, wq_id);if (!cc->io_queue) { ti->error ="Couldn't create kcryptd io queue" ; goto bad;
@@ -3408,7 +3410,7 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)if (test_bit (DM_CRYPT_SAME_CPU , &cc->flags)) { cc->crypt_queue =alloc_workqueue ("kcryptd-%s-%d" , - common_wq_flags |WQ_CPU_INTENSIVE , + common_wq_flags |WQ_CPU_INTENSIVE |WQ_PERCPU ,1 , devname, wq_id); }else {/*
drivers/md/dm-delay.c +3 -1
@@ -290,7 +290,9 @@ static int delay_ctr(struct dm_target *ti, unsigned int argc, char **argv) }else {timer_setup (&dc->delay_timer, handle_delayed_timer,0 );INIT_WORK (&dc->flush_expired_bios, flush_expired_bios); - dc->kdelayd_wq =alloc_workqueue ("kdelayd" ,WQ_MEM_RECLAIM ,0 ); + dc->kdelayd_wq =alloc_workqueue ("kdelayd" , +WQ_MEM_RECLAIM |WQ_PERCPU , +0 );if (!dc->kdelayd_wq) { ret = -EINVAL ;DMERR ("Couldn't start kdelayd" );
drivers/md/dm-integrity.c +10 -5
@@ -4990,7 +4990,8 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned int argc, char **argv } ic->metadata_wq =alloc_workqueue ("dm-integrity-metadata" , -WQ_MEM_RECLAIM ,METADATA_WORKQUEUE_MAX_ACTIVE ); +WQ_MEM_RECLAIM |WQ_PERCPU , +METADATA_WORKQUEUE_MAX_ACTIVE );if (!ic->metadata_wq) { ti->error ="Cannot allocate workqueue" ; r = -ENOMEM ;
@@ -5008,7 +5009,8 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned int argc, char **argv goto bad; } - ic->offload_wq =alloc_workqueue ("dm-integrity-offload" ,WQ_MEM_RECLAIM , + ic->offload_wq =alloc_workqueue ("dm-integrity-offload" , +WQ_MEM_RECLAIM |WQ_PERCPU ,METADATA_WORKQUEUE_MAX_ACTIVE );if (!ic->offload_wq) { ti->error ="Cannot allocate workqueue" ;
@@ -5016,7 +5018,8 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned int argc, char **argv goto bad; } - ic->commit_wq =alloc_workqueue ("dm-integrity-commit" ,WQ_MEM_RECLAIM ,1 ); + ic->commit_wq =alloc_workqueue ("dm-integrity-commit" , +WQ_MEM_RECLAIM |WQ_PERCPU ,1 );if (!ic->commit_wq) { ti->error ="Cannot allocate workqueue" ; r = -ENOMEM ;
@@ -5025,7 +5028,8 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned int argc, char **argvINIT_WORK (&ic->commit_work, integrity_commit);if (ic->mode =='J' || ic->mode =='B' ) { - ic->writer_wq =alloc_workqueue ("dm-integrity-writer" ,WQ_MEM_RECLAIM ,1 ); + ic->writer_wq =alloc_workqueue ("dm-integrity-writer" , +WQ_MEM_RECLAIM |WQ_PERCPU ,1 );if (!ic->writer_wq) { ti->error ="Cannot allocate workqueue" ; r = -ENOMEM ;
@@ -5197,7 +5201,8 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned int argc, char **argv }if (ic->internal_hash) { - ic->recalc_wq =alloc_workqueue ("dm-integrity-recalc" ,WQ_MEM_RECLAIM ,1 ); + ic->recalc_wq =alloc_workqueue ("dm-integrity-recalc" , +WQ_MEM_RECLAIM |WQ_PERCPU ,1 );if (!ic->recalc_wq) { ti->error ="Cannot allocate workqueue" ; r = -ENOMEM ;
drivers/md/dm-kcopyd.c +2 -1
@@ -934,7 +934,8 @@ struct dm_kcopyd_client *dm_kcopyd_client_create(struct dm_kcopyd_throttle *thro goto bad_slab;INIT_WORK (&kc->kcopyd_work, do_work); - kc->kcopyd_wq =alloc_workqueue ("kcopyd" ,WQ_MEM_RECLAIM ,0 ); + kc->kcopyd_wq =alloc_workqueue ("kcopyd" ,WQ_MEM_RECLAIM |WQ_PERCPU , +0 );if (!kc->kcopyd_wq) { r = -ENOMEM ; goto bad_workqueue;
drivers/md/dm-log-userspace-base.c +2 -1
@@ -299,7 +299,8 @@ static int userspace_ctr(struct dm_dirty_log *log, struct dm_target *ti, }if (lc->integrated_flush) { - lc->dmlog_wq =alloc_workqueue ("dmlogd" ,WQ_MEM_RECLAIM ,0 ); + lc->dmlog_wq =alloc_workqueue ("dmlogd" , +WQ_MEM_RECLAIM |WQ_PERCPU ,0 );if (!lc->dmlog_wq) {DMERR ("couldn't start dmlogd" ); r = -ENOMEM ;
drivers/md/dm-mpath.c +3 -2
@@ -2328,7 +2328,8 @@ static int __init dm_multipath_init(void) {int r = -ENOMEM ; - kmultipathd =alloc_workqueue ("kmpathd" ,WQ_MEM_RECLAIM ,0 ); + kmultipathd =alloc_workqueue ("kmpathd" ,WQ_MEM_RECLAIM |WQ_PERCPU , +0 );if (!kmultipathd) {DMERR ("failed to create workqueue kmpathd" ); goto bad_alloc_kmultipathd;
@@ -2347,7 +2348,7 @@ static int __init dm_multipath_init(void) goto bad_alloc_kmpath_handlerd; } - dm_mpath_wq =alloc_workqueue ("dm_mpath_wq" ,0 ,0 ); + dm_mpath_wq =alloc_workqueue ("dm_mpath_wq" ,WQ_PERCPU ,0 );if (!dm_mpath_wq) {DMERR ("failed to create workqueue dm_mpath_wq" ); goto bad_alloc_dm_mpath_wq;
drivers/md/dm-raid1.c +3 -2
@@ -1128,7 +1128,8 @@ static int mirror_ctr(struct dm_target *ti, unsigned int argc, char **argv) ti->num_discard_bios =1 ; ti->per_io_data_size =sizeof (struct dm_raid1_bio_record ); - ms->kmirrord_wq =alloc_workqueue ("kmirrord" ,WQ_MEM_RECLAIM ,0 ); + ms->kmirrord_wq =alloc_workqueue ("kmirrord" , +WQ_MEM_RECLAIM |WQ_PERCPU ,0 );if (!ms->kmirrord_wq) {DMERR ("couldn't start kmirrord" ); r = -ENOMEM ;
@@ -1500,7 +1501,7 @@ static int __init dm_mirror_init(void) {int r; - dm_raid1_wq =alloc_workqueue ("dm_raid1_wq" ,0 ,0 ); + dm_raid1_wq =alloc_workqueue ("dm_raid1_wq" ,WQ_PERCPU ,0 );if (!dm_raid1_wq) {DMERR ("Failed to alloc workqueue" );return -ENOMEM ;
drivers/md/dm-snap-persistent.c +2 -1
@@ -871,7 +871,8 @@ static int persistent_ctr(struct dm_exception_store *store, char *options)atomic_set (&ps->pending_count,0 ); ps->callbacks =NULL ; - ps->metadata_wq =alloc_workqueue ("ksnaphd" ,WQ_MEM_RECLAIM ,0 ); + ps->metadata_wq =alloc_workqueue ("ksnaphd" , +WQ_MEM_RECLAIM |WQ_PERCPU ,0 );if (!ps->metadata_wq) {DMERR ("couldn't start header metadata update thread" ); r = -ENOMEM ;
drivers/md/dm-stripe.c +1 -1
@@ -489,7 +489,7 @@ int __init dm_stripe_init(void) {int r; - dm_stripe_wq =alloc_workqueue ("dm_stripe_wq" ,0 ,0 ); + dm_stripe_wq =alloc_workqueue ("dm_stripe_wq" ,WQ_PERCPU ,0 );if (!dm_stripe_wq)return -ENOMEM ; r =dm_register_target (&stripe_target);
drivers/md/dm-verity-target.c +3 -1
@@ -1651,7 +1651,9 @@ static int verity_ctr(struct dm_target *ti, unsigned int argc, char **argv)* will fall-back to using it for error handling (or if the bufio cache * doesn't have required hashes). */ - v->verify_wq =alloc_workqueue ("kverityd" ,WQ_MEM_RECLAIM |WQ_HIGHPRI ,0 ); + v->verify_wq =alloc_workqueue ("kverityd" , +WQ_MEM_RECLAIM |WQ_HIGHPRI |WQ_PERCPU , +0 );if (!v->verify_wq) { ti->error ="Cannot allocate workqueue" ; r = -ENOMEM ;
drivers/md/dm-writecache.c +2 -1
@@ -2275,7 +2275,8 @@ static int writecache_ctr(struct dm_target *ti, unsigned int argc, char **argv) goto bad; } - wc->writeback_wq =alloc_workqueue ("writecache-writeback" ,WQ_MEM_RECLAIM ,1 ); + wc->writeback_wq =alloc_workqueue ("writecache-writeback" , +WQ_MEM_RECLAIM |WQ_PERCPU ,1 );if (!wc->writeback_wq) { r = -ENOMEM ; ti->error ="Could not allocate writeback workqueue" ;
drivers/md/dm.c +2 -1
@@ -2366,7 +2366,8 @@ static struct mapped_device *alloc_dev(int minor)format_dev_t (md->name,MKDEV (_major, minor)); - md->wq =alloc_workqueue ("kdmflush/%s" ,WQ_MEM_RECLAIM ,0 , md->name); + md->wq =alloc_workqueue ("kdmflush/%s" ,WQ_MEM_RECLAIM |WQ_PERCPU ,0 , + md->name);if (!md->wq) goto bad;
drivers/md/md.c +2 -2
@@ -10493,11 +10493,11 @@ static int __init md_init(void) goto err_bitmap; ret = -ENOMEM ; - md_wq =alloc_workqueue ("md" ,WQ_MEM_RECLAIM ,0 ); + md_wq =alloc_workqueue ("md" ,WQ_MEM_RECLAIM |WQ_PERCPU ,0 );if (!md_wq) goto err_wq; - md_misc_wq =alloc_workqueue ("md_misc" ,0 ,0 ); + md_misc_wq =alloc_workqueue ("md_misc" ,WQ_PERCPU ,0 );if (!md_misc_wq) goto err_misc_wq;
Signature · 1 line
2.52.0
Quoted 9 lines · Marco Crivellari
drivers/md/dm-bufio.c | 3 ++- drivers/md/dm-cache-target.c | 3 ++- drivers/md/dm-clone-target.c | 3 ++- drivers/md/dm-crypt.c | 6 ++++-- drivers/md/dm-delay.c | 4 +++- drivers/md/dm-integrity.c | 15 ++++++++++----- drivers/md/dm-kcopyd.c | 3 ++- drivers/md/dm-log-userspace-base.c | 3 ++- drivers/md/dm-mpath.c | 5 +++--
Quoted 8 lines
drivers/md/dm-raid1.c | 5 +++-- drivers/md/dm-snap-persistent.c | 3 ++- drivers/md/dm-stripe.c | 2 +- drivers/md/dm-verity-target.c | 4 +++- drivers/md/dm-writecache.c | 3 ++- drivers/md/dm.c | 3 ++- drivers/md/md.c | 4 ++-- 16 files changed, 45 insertions(+), 24 deletions(-)
Gentle ping.
Thanks!
Signature · 3 lines
Marco Crivellari L3 Support Engineer
Mikulas Patocka
maintainerQuoted 20 lines · Marco Crivellari
Quoted 9 lines · Marco Crivellari
drivers/md/dm-bufio.c | 3 ++- drivers/md/dm-cache-target.c | 3 ++- drivers/md/dm-clone-target.c | 3 ++- drivers/md/dm-crypt.c | 6 ++++-- drivers/md/dm-delay.c | 4 +++- drivers/md/dm-integrity.c | 15 ++++++++++----- drivers/md/dm-kcopyd.c | 3 ++- drivers/md/dm-log-userspace-base.c | 3 ++- drivers/md/dm-mpath.c | 5 +++--Quoted 8 lines
drivers/md/dm-raid1.c | 5 +++-- drivers/md/dm-snap-persistent.c | 3 ++- drivers/md/dm-stripe.c | 2 +- drivers/md/dm-verity-target.c | 4 +++- drivers/md/dm-writecache.c | 3 ++- drivers/md/dm.c | 3 ++- drivers/md/md.c | 4 ++-- 16 files changed, 45 insertions(+), 24 deletions(-)
Quoted 3 lines
Gentle ping.
Thanks!
Hi
The patch was already committed to 7.0-rc1. See the commit d4880868670198df321627a949e7b7f2d76cf54e.
Mikulas
Quoted 7 lines · Mikulas Patocka
[...]
HiThe patch was already committed to 7.0-rc1. See the commit
d4880868670198df321627a949e7b7f2d76cf54e.Mikulas
Hi,
Ouch, many thanks!
Signature · 3 lines
Marco Crivellari L3 Support Engineer