Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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.

Link: https://lore.kernel.org/all/20250221112003.1dSuoGyc@linutronix.de/
Suggested-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Marco Crivellari <marco.crivellari@suse.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

authored by

Marco Crivellari and committed by
Mikulas Patocka
d4880868 c698b7f4

+45 -24
+2 -1
drivers/md/dm-bufio.c
··· 2833 2833 __cache_size_refresh(); 2834 2834 mutex_unlock(&dm_bufio_clients_lock); 2835 2835 2836 - dm_bufio_wq = alloc_workqueue("dm_bufio_cache", WQ_MEM_RECLAIM, 0); 2836 + dm_bufio_wq = alloc_workqueue("dm_bufio_cache", 2837 + WQ_MEM_RECLAIM | WQ_PERCPU, 0); 2837 2838 if (!dm_bufio_wq) 2838 2839 return -ENOMEM; 2839 2840
+2 -1
drivers/md/dm-cache-target.c
··· 2526 2526 goto bad; 2527 2527 } 2528 2528 2529 - cache->wq = alloc_workqueue("dm-" DM_MSG_PREFIX, WQ_MEM_RECLAIM, 0); 2529 + cache->wq = alloc_workqueue("dm-" DM_MSG_PREFIX, 2530 + WQ_MEM_RECLAIM | WQ_PERCPU, 0); 2530 2531 if (!cache->wq) { 2531 2532 *error = "could not create workqueue for metadata object"; 2532 2533 goto bad;
+2 -1
drivers/md/dm-clone-target.c
··· 1861 1861 clone->hydration_offset = 0; 1862 1862 atomic_set(&clone->hydrations_in_flight, 0); 1863 1863 1864 - clone->wq = alloc_workqueue("dm-" DM_MSG_PREFIX, WQ_MEM_RECLAIM, 0); 1864 + clone->wq = alloc_workqueue("dm-" DM_MSG_PREFIX, 1865 + WQ_MEM_RECLAIM | WQ_PERCPU, 0); 1865 1866 if (!clone->wq) { 1866 1867 ti->error = "Failed to allocate workqueue"; 1867 1868 r = -ENOMEM;
+4 -2
drivers/md/dm-crypt.c
··· 3400 3400 if (test_bit(DM_CRYPT_HIGH_PRIORITY, &cc->flags)) 3401 3401 common_wq_flags |= WQ_HIGHPRI; 3402 3402 3403 - cc->io_queue = alloc_workqueue("kcryptd_io-%s-%d", common_wq_flags, 1, devname, wq_id); 3403 + cc->io_queue = alloc_workqueue("kcryptd_io-%s-%d", 3404 + common_wq_flags | WQ_PERCPU, 1, 3405 + devname, wq_id); 3404 3406 if (!cc->io_queue) { 3405 3407 ti->error = "Couldn't create kcryptd io queue"; 3406 3408 goto bad; ··· 3410 3408 3411 3409 if (test_bit(DM_CRYPT_SAME_CPU, &cc->flags)) { 3412 3410 cc->crypt_queue = alloc_workqueue("kcryptd-%s-%d", 3413 - common_wq_flags | WQ_CPU_INTENSIVE, 3411 + common_wq_flags | WQ_CPU_INTENSIVE | WQ_PERCPU, 3414 3412 1, devname, wq_id); 3415 3413 } else { 3416 3414 /*
+3 -1
drivers/md/dm-delay.c
··· 290 290 } else { 291 291 timer_setup(&dc->delay_timer, handle_delayed_timer, 0); 292 292 INIT_WORK(&dc->flush_expired_bios, flush_expired_bios); 293 - dc->kdelayd_wq = alloc_workqueue("kdelayd", WQ_MEM_RECLAIM, 0); 293 + dc->kdelayd_wq = alloc_workqueue("kdelayd", 294 + WQ_MEM_RECLAIM | WQ_PERCPU, 295 + 0); 294 296 if (!dc->kdelayd_wq) { 295 297 ret = -EINVAL; 296 298 DMERR("Couldn't start kdelayd");
+10 -5
drivers/md/dm-integrity.c
··· 4990 4990 } 4991 4991 4992 4992 ic->metadata_wq = alloc_workqueue("dm-integrity-metadata", 4993 - WQ_MEM_RECLAIM, METADATA_WORKQUEUE_MAX_ACTIVE); 4993 + WQ_MEM_RECLAIM | WQ_PERCPU, 4994 + METADATA_WORKQUEUE_MAX_ACTIVE); 4994 4995 if (!ic->metadata_wq) { 4995 4996 ti->error = "Cannot allocate workqueue"; 4996 4997 r = -ENOMEM; ··· 5009 5008 goto bad; 5010 5009 } 5011 5010 5012 - ic->offload_wq = alloc_workqueue("dm-integrity-offload", WQ_MEM_RECLAIM, 5011 + ic->offload_wq = alloc_workqueue("dm-integrity-offload", 5012 + WQ_MEM_RECLAIM | WQ_PERCPU, 5013 5013 METADATA_WORKQUEUE_MAX_ACTIVE); 5014 5014 if (!ic->offload_wq) { 5015 5015 ti->error = "Cannot allocate workqueue"; ··· 5018 5016 goto bad; 5019 5017 } 5020 5018 5021 - ic->commit_wq = alloc_workqueue("dm-integrity-commit", WQ_MEM_RECLAIM, 1); 5019 + ic->commit_wq = alloc_workqueue("dm-integrity-commit", 5020 + WQ_MEM_RECLAIM | WQ_PERCPU, 1); 5022 5021 if (!ic->commit_wq) { 5023 5022 ti->error = "Cannot allocate workqueue"; 5024 5023 r = -ENOMEM; ··· 5028 5025 INIT_WORK(&ic->commit_work, integrity_commit); 5029 5026 5030 5027 if (ic->mode == 'J' || ic->mode == 'B') { 5031 - ic->writer_wq = alloc_workqueue("dm-integrity-writer", WQ_MEM_RECLAIM, 1); 5028 + ic->writer_wq = alloc_workqueue("dm-integrity-writer", 5029 + WQ_MEM_RECLAIM | WQ_PERCPU, 1); 5032 5030 if (!ic->writer_wq) { 5033 5031 ti->error = "Cannot allocate workqueue"; 5034 5032 r = -ENOMEM; ··· 5201 5197 } 5202 5198 5203 5199 if (ic->internal_hash) { 5204 - ic->recalc_wq = alloc_workqueue("dm-integrity-recalc", WQ_MEM_RECLAIM, 1); 5200 + ic->recalc_wq = alloc_workqueue("dm-integrity-recalc", 5201 + WQ_MEM_RECLAIM | WQ_PERCPU, 1); 5205 5202 if (!ic->recalc_wq) { 5206 5203 ti->error = "Cannot allocate workqueue"; 5207 5204 r = -ENOMEM;
+2 -1
drivers/md/dm-kcopyd.c
··· 934 934 goto bad_slab; 935 935 936 936 INIT_WORK(&kc->kcopyd_work, do_work); 937 - kc->kcopyd_wq = alloc_workqueue("kcopyd", WQ_MEM_RECLAIM, 0); 937 + kc->kcopyd_wq = alloc_workqueue("kcopyd", WQ_MEM_RECLAIM | WQ_PERCPU, 938 + 0); 938 939 if (!kc->kcopyd_wq) { 939 940 r = -ENOMEM; 940 941 goto bad_workqueue;
+2 -1
drivers/md/dm-log-userspace-base.c
··· 299 299 } 300 300 301 301 if (lc->integrated_flush) { 302 - lc->dmlog_wq = alloc_workqueue("dmlogd", WQ_MEM_RECLAIM, 0); 302 + lc->dmlog_wq = alloc_workqueue("dmlogd", 303 + WQ_MEM_RECLAIM | WQ_PERCPU, 0); 303 304 if (!lc->dmlog_wq) { 304 305 DMERR("couldn't start dmlogd"); 305 306 r = -ENOMEM;
+3 -2
drivers/md/dm-mpath.c
··· 2328 2328 { 2329 2329 int r = -ENOMEM; 2330 2330 2331 - kmultipathd = alloc_workqueue("kmpathd", WQ_MEM_RECLAIM, 0); 2331 + kmultipathd = alloc_workqueue("kmpathd", WQ_MEM_RECLAIM | WQ_PERCPU, 2332 + 0); 2332 2333 if (!kmultipathd) { 2333 2334 DMERR("failed to create workqueue kmpathd"); 2334 2335 goto bad_alloc_kmultipathd; ··· 2348 2347 goto bad_alloc_kmpath_handlerd; 2349 2348 } 2350 2349 2351 - dm_mpath_wq = alloc_workqueue("dm_mpath_wq", 0, 0); 2350 + dm_mpath_wq = alloc_workqueue("dm_mpath_wq", WQ_PERCPU, 0); 2352 2351 if (!dm_mpath_wq) { 2353 2352 DMERR("failed to create workqueue dm_mpath_wq"); 2354 2353 goto bad_alloc_dm_mpath_wq;
+3 -2
drivers/md/dm-raid1.c
··· 1128 1128 ti->num_discard_bios = 1; 1129 1129 ti->per_io_data_size = sizeof(struct dm_raid1_bio_record); 1130 1130 1131 - ms->kmirrord_wq = alloc_workqueue("kmirrord", WQ_MEM_RECLAIM, 0); 1131 + ms->kmirrord_wq = alloc_workqueue("kmirrord", 1132 + WQ_MEM_RECLAIM | WQ_PERCPU, 0); 1132 1133 if (!ms->kmirrord_wq) { 1133 1134 DMERR("couldn't start kmirrord"); 1134 1135 r = -ENOMEM; ··· 1501 1500 { 1502 1501 int r; 1503 1502 1504 - dm_raid1_wq = alloc_workqueue("dm_raid1_wq", 0, 0); 1503 + dm_raid1_wq = alloc_workqueue("dm_raid1_wq", WQ_PERCPU, 0); 1505 1504 if (!dm_raid1_wq) { 1506 1505 DMERR("Failed to alloc workqueue"); 1507 1506 return -ENOMEM;
+2 -1
drivers/md/dm-snap-persistent.c
··· 871 871 atomic_set(&ps->pending_count, 0); 872 872 ps->callbacks = NULL; 873 873 874 - ps->metadata_wq = alloc_workqueue("ksnaphd", WQ_MEM_RECLAIM, 0); 874 + ps->metadata_wq = alloc_workqueue("ksnaphd", 875 + WQ_MEM_RECLAIM | WQ_PERCPU, 0); 875 876 if (!ps->metadata_wq) { 876 877 DMERR("couldn't start header metadata update thread"); 877 878 r = -ENOMEM;
+1 -1
drivers/md/dm-stripe.c
··· 497 497 { 498 498 int r; 499 499 500 - dm_stripe_wq = alloc_workqueue("dm_stripe_wq", 0, 0); 500 + dm_stripe_wq = alloc_workqueue("dm_stripe_wq", WQ_PERCPU, 0); 501 501 if (!dm_stripe_wq) 502 502 return -ENOMEM; 503 503 r = dm_register_target(&stripe_target);
+3 -1
drivers/md/dm-verity-target.c
··· 1648 1648 * will fall-back to using it for error handling (or if the bufio cache 1649 1649 * doesn't have required hashes). 1650 1650 */ 1651 - v->verify_wq = alloc_workqueue("kverityd", WQ_MEM_RECLAIM | WQ_HIGHPRI, 0); 1651 + v->verify_wq = alloc_workqueue("kverityd", 1652 + WQ_MEM_RECLAIM | WQ_HIGHPRI | WQ_PERCPU, 1653 + 0); 1652 1654 if (!v->verify_wq) { 1653 1655 ti->error = "Cannot allocate workqueue"; 1654 1656 r = -ENOMEM;
+2 -1
drivers/md/dm-writecache.c
··· 2275 2275 goto bad; 2276 2276 } 2277 2277 2278 - wc->writeback_wq = alloc_workqueue("writecache-writeback", WQ_MEM_RECLAIM, 1); 2278 + wc->writeback_wq = alloc_workqueue("writecache-writeback", 2279 + WQ_MEM_RECLAIM | WQ_PERCPU, 1); 2279 2280 if (!wc->writeback_wq) { 2280 2281 r = -ENOMEM; 2281 2282 ti->error = "Could not allocate writeback workqueue";
+2 -1
drivers/md/dm.c
··· 2366 2366 2367 2367 format_dev_t(md->name, MKDEV(_major, minor)); 2368 2368 2369 - md->wq = alloc_workqueue("kdmflush/%s", WQ_MEM_RECLAIM, 0, md->name); 2369 + md->wq = alloc_workqueue("kdmflush/%s", WQ_MEM_RECLAIM | WQ_PERCPU, 0, 2370 + md->name); 2370 2371 if (!md->wq) 2371 2372 goto bad; 2372 2373
+2 -2
drivers/md/md.c
··· 10454 10454 goto err_bitmap; 10455 10455 10456 10456 ret = -ENOMEM; 10457 - md_wq = alloc_workqueue("md", WQ_MEM_RECLAIM, 0); 10457 + md_wq = alloc_workqueue("md", WQ_MEM_RECLAIM | WQ_PERCPU, 0); 10458 10458 if (!md_wq) 10459 10459 goto err_wq; 10460 10460 10461 - md_misc_wq = alloc_workqueue("md_misc", 0, 0); 10461 + md_misc_wq = alloc_workqueue("md_misc", WQ_PERCPU, 0); 10462 10462 if (!md_misc_wq) 10463 10463 goto err_misc_wq; 10464 10464