Skip to content

Commit 4ef64db

Browse files
DispatchCodebrauner
authored andcommitted
fs: replace use of system_wq with system_percpu_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_wq is a per-CPU worqueue, yet nothing in its name tells about that CPU affinity constraint, which is very often not required by users. Make it clear by adding a system_percpu_wq to all the fs subsystem. The old wq will be kept for a few release cylces. Suggested-by: Tejun Heo <tj@kernel.org> Signed-off-by: Marco Crivellari <marco.crivellari@suse.com> Link: https://lore.kernel.org/20250916082906.77439-3-marco.crivellari@suse.com Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 7a4f92d commit 4ef64db

6 files changed

Lines changed: 6 additions & 6 deletions

File tree

fs/aio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ static void free_ioctx_reqs(struct percpu_ref *ref)
636636

637637
/* Synchronize against RCU protected table->table[] dereferences */
638638
INIT_RCU_WORK(&ctx->free_rwork, free_ioctx);
639-
queue_rcu_work(system_wq, &ctx->free_rwork);
639+
queue_rcu_work(system_percpu_wq, &ctx->free_rwork);
640640
}
641641

642642
/*

fs/fs-writeback.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2442,7 +2442,7 @@ static int dirtytime_interval_handler(const struct ctl_table *table, int write,
24422442

24432443
ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
24442444
if (ret == 0 && write)
2445-
mod_delayed_work(system_wq, &dirtytime_work, 0);
2445+
mod_delayed_work(system_percpu_wq, &dirtytime_work, 0);
24462446
return ret;
24472447
}
24482448

fs/fuse/dev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ void fuse_check_timeout(struct work_struct *work)
119119
goto abort_conn;
120120

121121
out:
122-
queue_delayed_work(system_wq, &fc->timeout.work,
122+
queue_delayed_work(system_percpu_wq, &fc->timeout.work,
123123
fuse_timeout_timer_freq);
124124
return;
125125

fs/fuse/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1273,7 +1273,7 @@ static void set_request_timeout(struct fuse_conn *fc, unsigned int timeout)
12731273
{
12741274
fc->timeout.req_timeout = secs_to_jiffies(timeout);
12751275
INIT_DELAYED_WORK(&fc->timeout.work, fuse_check_timeout);
1276-
queue_delayed_work(system_wq, &fc->timeout.work,
1276+
queue_delayed_work(system_percpu_wq, &fc->timeout.work,
12771277
fuse_timeout_timer_freq);
12781278
}
12791279

fs/nfs/namespace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ static int param_set_nfs_timeout(const char *val, const struct kernel_param *kp)
335335
num *= HZ;
336336
*((int *)kp->arg) = num;
337337
if (!list_empty(&nfs_automount_list))
338-
mod_delayed_work(system_wq, &nfs_automount_task, num);
338+
mod_delayed_work(system_percpu_wq, &nfs_automount_task, num);
339339
} else {
340340
*((int *)kp->arg) = -1*HZ;
341341
cancel_delayed_work(&nfs_automount_task);

fs/nfs/nfs4renewd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ nfs4_schedule_state_renewal(struct nfs_client *clp)
122122
timeout = 5 * HZ;
123123
dprintk("%s: requeueing work. Lease period = %ld\n",
124124
__func__, (timeout + HZ - 1) / HZ);
125-
mod_delayed_work(system_wq, &clp->cl_renewd, timeout);
125+
mod_delayed_work(system_percpu_wq, &clp->cl_renewd, timeout);
126126
set_bit(NFS_CS_RENEWD, &clp->cl_res_state);
127127
spin_unlock(&clp->cl_lock);
128128
}

0 commit comments

Comments
 (0)