Unverified Commit 7a4f92d3 authored by Marco Crivellari's avatar Marco Crivellari Committed by Christian Brauner
Browse files

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: default avatarTejun Heo <tj@kernel.org>
Signed-off-by: default avatarMarco Crivellari <marco.crivellari@suse.com>
Link: https://lore.kernel.org/20250916082906.77439-2-marco.crivellari@suse.com


Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent 8f5ae30d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ static void afs_volume_init_callback(struct afs_volume *volume)
	list_for_each_entry(vnode, &volume->open_mmaps, cb_mmap_link) {
		if (vnode->cb_v_check != atomic_read(&volume->cb_v_break)) {
			afs_clear_cb_promise(vnode, afs_cb_promise_clear_vol_init_cb);
			queue_work(system_unbound_wq, &vnode->cb_work);
			queue_work(system_dfl_wq, &vnode->cb_work);
		}
	}

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

		trace_afs_cb_break(&vnode->fid, vnode->cb_break, reason, true);
	} else {
+1 −1
Original line number Diff line number Diff line
@@ -172,7 +172,7 @@ static void afs_issue_write_worker(struct work_struct *work)
void afs_issue_write(struct netfs_io_subrequest *subreq)
{
	subreq->work.func = afs_issue_write_worker;
	if (!queue_work(system_unbound_wq, &subreq->work))
	if (!queue_work(system_dfl_wq, &subreq->work))
		WARN_ON_ONCE(1);
}

+1 −1
Original line number Diff line number Diff line
@@ -827,7 +827,7 @@ int bch2_journal_keys_to_write_buffer_end(struct bch_fs *c, struct journal_keys_

	if (bch2_btree_write_buffer_should_flush(c) &&
	    __enumerated_ref_tryget(&c->writes, BCH_WRITE_REF_btree_write_buffer) &&
	    !queue_work(system_unbound_wq, &c->btree_write_buffer.flush_work))
	    !queue_work(system_dfl_wq, &c->btree_write_buffer.flush_work))
		enumerated_ref_put(&c->writes, BCH_WRITE_REF_btree_write_buffer);

	if (dst->wb == &wb->flushing)
+4 −4
Original line number Diff line number Diff line
@@ -684,7 +684,7 @@ static void bch2_rbio_error(struct bch_read_bio *rbio,

	if (bch2_err_matches(ret, BCH_ERR_data_read_retry)) {
		bch2_rbio_punt(rbio, bch2_rbio_retry,
			       RBIO_CONTEXT_UNBOUND, system_unbound_wq);
			       RBIO_CONTEXT_UNBOUND, system_dfl_wq);
	} else {
		rbio = bch2_rbio_free(rbio);

@@ -921,10 +921,10 @@ static void __bch2_read_endio(struct work_struct *work)
	bch2_rbio_error(rbio, -BCH_ERR_data_read_retry_csum_err, BLK_STS_IOERR);
	goto out;
decompression_err:
	bch2_rbio_punt(rbio, bch2_read_decompress_err, RBIO_CONTEXT_UNBOUND, system_unbound_wq);
	bch2_rbio_punt(rbio, bch2_read_decompress_err, RBIO_CONTEXT_UNBOUND, system_dfl_wq);
	goto out;
decrypt_err:
	bch2_rbio_punt(rbio, bch2_read_decrypt_err, RBIO_CONTEXT_UNBOUND, system_unbound_wq);
	bch2_rbio_punt(rbio, bch2_read_decrypt_err, RBIO_CONTEXT_UNBOUND, system_dfl_wq);
	goto out;
}

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

+1 −1
Original line number Diff line number Diff line
@@ -1362,7 +1362,7 @@ int bch2_journal_read(struct bch_fs *c,
					  BCH_DEV_READ_REF_journal_read))
			closure_call(&ca->journal.read,
				     bch2_journal_read_device,
				     system_unbound_wq,
				     system_dfl_wq,
				     &jlist.cl);
		else
			degraded = true;
Loading