Skip to content

Commit 7a4f92d

Browse files
DispatchCodebrauner
authored andcommitted
fs: replace use of system_unbound_wq with system_dfl_wq
Currently if a user enqueue a work item using schedule_delayed_work() the used wq is "system_wq" (per-cpu wq) while queue_delayed_work() use WORK_CPU_UNBOUND (used when a cpu is not specified). The same applies to schedule_work() that is using system_wq and queue_work(), that makes use again of WORK_CPU_UNBOUND. This lack of consistentcy cannot be addressed without refactoring the API. system_unbound_wq should be the default workqueue so as not to enforce locality constraints for random work whenever it's not required. Adding system_dfl_wq to encourage its use when unbound work should be used. The old system_unbound_wq will be kept for a few release cycles. Suggested-by: Tejun Heo <tj@kernel.org> Signed-off-by: Marco Crivellari <marco.crivellari@suse.com> Link: https://lore.kernel.org/20250916082906.77439-2-marco.crivellari@suse.com Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 8f5ae30 commit 7a4f92d

16 files changed

Lines changed: 22 additions & 22 deletions

File tree

fs/afs/callback.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ static void afs_volume_init_callback(struct afs_volume *volume)
4242
list_for_each_entry(vnode, &volume->open_mmaps, cb_mmap_link) {
4343
if (vnode->cb_v_check != atomic_read(&volume->cb_v_break)) {
4444
afs_clear_cb_promise(vnode, afs_cb_promise_clear_vol_init_cb);
45-
queue_work(system_unbound_wq, &vnode->cb_work);
45+
queue_work(system_dfl_wq, &vnode->cb_work);
4646
}
4747
}
4848

@@ -90,7 +90,7 @@ void __afs_break_callback(struct afs_vnode *vnode, enum afs_cb_break_reason reas
9090
if (reason != afs_cb_break_for_deleted &&
9191
vnode->status.type == AFS_FTYPE_FILE &&
9292
atomic_read(&vnode->cb_nr_mmap))
93-
queue_work(system_unbound_wq, &vnode->cb_work);
93+
queue_work(system_dfl_wq, &vnode->cb_work);
9494

9595
trace_afs_cb_break(&vnode->fid, vnode->cb_break, reason, true);
9696
} else {

fs/afs/write.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ static void afs_issue_write_worker(struct work_struct *work)
172172
void afs_issue_write(struct netfs_io_subrequest *subreq)
173173
{
174174
subreq->work.func = afs_issue_write_worker;
175-
if (!queue_work(system_unbound_wq, &subreq->work))
175+
if (!queue_work(system_dfl_wq, &subreq->work))
176176
WARN_ON_ONCE(1);
177177
}
178178

fs/bcachefs/btree_write_buffer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ int bch2_journal_keys_to_write_buffer_end(struct bch_fs *c, struct journal_keys_
827827

828828
if (bch2_btree_write_buffer_should_flush(c) &&
829829
__enumerated_ref_tryget(&c->writes, BCH_WRITE_REF_btree_write_buffer) &&
830-
!queue_work(system_unbound_wq, &c->btree_write_buffer.flush_work))
830+
!queue_work(system_dfl_wq, &c->btree_write_buffer.flush_work))
831831
enumerated_ref_put(&c->writes, BCH_WRITE_REF_btree_write_buffer);
832832

833833
if (dst->wb == &wb->flushing)

fs/bcachefs/io_read.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ static void bch2_rbio_error(struct bch_read_bio *rbio,
684684

685685
if (bch2_err_matches(ret, BCH_ERR_data_read_retry)) {
686686
bch2_rbio_punt(rbio, bch2_rbio_retry,
687-
RBIO_CONTEXT_UNBOUND, system_unbound_wq);
687+
RBIO_CONTEXT_UNBOUND, system_dfl_wq);
688688
} else {
689689
rbio = bch2_rbio_free(rbio);
690690

@@ -921,10 +921,10 @@ static void __bch2_read_endio(struct work_struct *work)
921921
bch2_rbio_error(rbio, -BCH_ERR_data_read_retry_csum_err, BLK_STS_IOERR);
922922
goto out;
923923
decompression_err:
924-
bch2_rbio_punt(rbio, bch2_read_decompress_err, RBIO_CONTEXT_UNBOUND, system_unbound_wq);
924+
bch2_rbio_punt(rbio, bch2_read_decompress_err, RBIO_CONTEXT_UNBOUND, system_dfl_wq);
925925
goto out;
926926
decrypt_err:
927-
bch2_rbio_punt(rbio, bch2_read_decrypt_err, RBIO_CONTEXT_UNBOUND, system_unbound_wq);
927+
bch2_rbio_punt(rbio, bch2_read_decrypt_err, RBIO_CONTEXT_UNBOUND, system_dfl_wq);
928928
goto out;
929929
}
930930

@@ -963,7 +963,7 @@ static void bch2_read_endio(struct bio *bio)
963963
rbio->promote ||
964964
crc_is_compressed(rbio->pick.crc) ||
965965
bch2_csum_type_is_encryption(rbio->pick.crc.csum_type))
966-
context = RBIO_CONTEXT_UNBOUND, wq = system_unbound_wq;
966+
context = RBIO_CONTEXT_UNBOUND, wq = system_dfl_wq;
967967
else if (rbio->pick.crc.csum_type)
968968
context = RBIO_CONTEXT_HIGHPRI, wq = system_highpri_wq;
969969

fs/bcachefs/journal_io.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1362,7 +1362,7 @@ int bch2_journal_read(struct bch_fs *c,
13621362
BCH_DEV_READ_REF_journal_read))
13631363
closure_call(&ca->journal.read,
13641364
bch2_journal_read_device,
1365-
system_unbound_wq,
1365+
system_dfl_wq,
13661366
&jlist.cl);
13671367
else
13681368
degraded = true;

fs/btrfs/block-group.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2031,7 +2031,7 @@ void btrfs_reclaim_bgs(struct btrfs_fs_info *fs_info)
20312031
btrfs_reclaim_sweep(fs_info);
20322032
spin_lock(&fs_info->unused_bgs_lock);
20332033
if (!list_empty(&fs_info->reclaim_bgs))
2034-
queue_work(system_unbound_wq, &fs_info->reclaim_bgs_work);
2034+
queue_work(system_dfl_wq, &fs_info->reclaim_bgs_work);
20352035
spin_unlock(&fs_info->unused_bgs_lock);
20362036
}
20372037

fs/btrfs/extent_map.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1372,7 +1372,7 @@ void btrfs_free_extent_maps(struct btrfs_fs_info *fs_info, long nr_to_scan)
13721372
if (atomic64_cmpxchg(&fs_info->em_shrinker_nr_to_scan, 0, nr_to_scan) != 0)
13731373
return;
13741374

1375-
queue_work(system_unbound_wq, &fs_info->em_shrinker_work);
1375+
queue_work(system_dfl_wq, &fs_info->em_shrinker_work);
13761376
}
13771377

13781378
void btrfs_init_extent_map_shrinker_work(struct btrfs_fs_info *fs_info)

fs/btrfs/space-info.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1830,7 +1830,7 @@ static int __reserve_bytes(struct btrfs_fs_info *fs_info,
18301830
space_info->flags,
18311831
orig_bytes, flush,
18321832
"enospc");
1833-
queue_work(system_unbound_wq, async_work);
1833+
queue_work(system_dfl_wq, async_work);
18341834
}
18351835
} else {
18361836
list_add_tail(&ticket.list,
@@ -1847,7 +1847,7 @@ static int __reserve_bytes(struct btrfs_fs_info *fs_info,
18471847
need_preemptive_reclaim(fs_info, space_info)) {
18481848
trace_btrfs_trigger_flush(fs_info, space_info->flags,
18491849
orig_bytes, flush, "preempt");
1850-
queue_work(system_unbound_wq,
1850+
queue_work(system_dfl_wq,
18511851
&fs_info->preempt_reclaim_work);
18521852
}
18531853
}

fs/btrfs/zoned.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2488,7 +2488,7 @@ void btrfs_schedule_zone_finish_bg(struct btrfs_block_group *bg,
24882488
refcount_inc(&eb->refs);
24892489
bg->last_eb = eb;
24902490
INIT_WORK(&bg->zone_finish_work, btrfs_zone_finish_endio_workfn);
2491-
queue_work(system_unbound_wq, &bg->zone_finish_work);
2491+
queue_work(system_dfl_wq, &bg->zone_finish_work);
24922492
}
24932493

24942494
void btrfs_clear_data_reloc_bg(struct btrfs_block_group *bg)

fs/coredump.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ static int umh_coredump_setup(struct subprocess_info *info, struct cred *new)
635635

636636
/*
637637
* Usermode helpers are childen of either
638-
* system_unbound_wq or of kthreadd. So we know that
638+
* system_dfl_wq or of kthreadd. So we know that
639639
* we're starting off with a clean file descriptor
640640
* table. So we should always be able to use
641641
* COREDUMP_PIDFD_NUMBER as our file descriptor value.

0 commit comments

Comments
 (0)