From nobody Sat Oct 4 14:36:14 2025 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D8A01EBA14 for ; Fri, 15 Aug 2025 09:47:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755251250; cv=none; b=rfpwR8VgVcHN2LaO6dZKWUV6nHeSLe09umzV0x0qDhAe46/XH+aaZremTRJYlNu8YXI6+9w4KUxT1LlUb0bN2+Z6kIXAglTmymcYTHTgJxRVvhFwClC2wKR92Kc1mlj+qhgOhFTVF3tyFOE8q/Cdy8lk+Ysp5Ee9w3U1AQafSDU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755251250; c=relaxed/simple; bh=lTQ5tpiaUIBr6tU7mj0dwA/6Z4MoV1fHePe29ZV8Y5g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QYOYzAE2JfB8Rn9/MEz0zRNj1Usiqs0AdfMzQq4qDlHtKpoSb1fXNbWCk11V2wggA8ET1oJLObFmvO2e3iYetLIHHDRtn/9QrWrvN+ekw8iL5AqIpUDVSM+Li+4RM6zzOO7mpE/GgPcrEs2bnpaMxVQSX9LdLyTEFewm7ZRYLnM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=PECbCfN1; arc=none smtp.client-ip=209.85.128.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="PECbCfN1" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-45a1b065d58so12325315e9.1 for ; Fri, 15 Aug 2025 02:47:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1755251247; x=1755856047; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ivrbru2LNxSs8CTXNjbMj9DkY8mGo4uquvi8+ow7/88=; b=PECbCfN15pXN7Yg+fS1aAdCgB7Agq0bk5ZiT8YpcqOq5LMdYOp1dHoVTVjMKyBVDqQ 9TTz8k2fUjrOcLDFC9OBWPCyA4hRmZKo56xnjdjR46g8+CdltlpJdVAY3OuJpdlPykbK CnXi7QQGeVM2FGxD8L/2LKtG/sWpEH6OUdR2JLd/jdmYKzP4cID3wAzfM9XjEmp4UhRW fGkgD5RfLS6gBAhNTJCIFIykxOlbWKAn7c2PbXxEvkcU06dZRiC738+whU5dSuJNeq1m JsmTwi+/k7rPdKio0lK5R79etgvWmyL5D5Q//VsnX+G5jnUNwUZ6yBCuB31c6w4cDLqT zeGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755251247; x=1755856047; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ivrbru2LNxSs8CTXNjbMj9DkY8mGo4uquvi8+ow7/88=; b=SpKg3WvFv2gsxUdJPVSlHl5d4aHdcvQWUiIT0marstkOPwotM3HKjJ+oqlj3N8IuCn H6keIMKkyVsb+R9Slw9+r5+JH98CX842BuOnma2giuCrGaHbFmEbwaN8dHpsVq+aTcox UONeJGhEWCtptDcGZDS+GHQc87KGAjCmxfKeGVPDn/R0XszTan1Pn7O7ARJRUYsaung+ EAkZ5/4xwuyMaKCL+31BqNxHJy51GeGkFZxwI8kSXZ79waKQan5p9ZKGV8S+kTOApXUZ 9sOqMY3lalHE/fOFxBl47Qu5YRx3w9zVfsPwqAyTYOu+zJQTgY1ifWyU1Rek3hsdqBfV lY4Q== X-Gm-Message-State: AOJu0YzcLhDKXj2GCwMjRtkR3IOJmsjM2QR8e/z2BA62DCdxXbbo2ByH 4/lE/GZPMFEcTxQFNQkhmxkP979kR0MKEcyy/VxkguqRqdgf1VzRog60+9E4RSb/ZUKRarJVfyk nGfzg X-Gm-Gg: ASbGncvE8kp6gApsawvjEiJORQTlECB4YyzTCJ7gc1w0T8ugGbaHJqB8nMUaI64JhRX PuzSjxFVIw/jP8FSNYLqnrCL8H5CB7GHuC//pNa51RQbfuvjFVqsrZLEQfBrG4Ql5yn36+IstC0 K/JA033MUOgVUMakmtgbm4Zg2WB6dcK0DiobdHKZ+JO+bOrpi1wX9SkHKsT3WPXbyJilVtrbyDF b/3QeDzR2tmlnKwViyb2TQs49n0IbR4xevGFQQm86jCR3PQ5WXgrYnUO14n/LrxnZiHDT88QdsO h6xMRhvCejZyC5s+cmt8FwUzPYPeBvk6XtmbWNTU4QrqlsNFKiZLYOUvLS/LQ8Tt+Q4o6BlQ3RA UugBFNnf8oy1kS8DTk3b+yI9pcA6F6S7R+2m/pK8azfDZeQ== X-Google-Smtp-Source: AGHT+IEWWcyeWf2RawrfispWFJ4ayT853diB9diyYZjKJIx+rPP6kPEBfuT4cX+69xNA9OsBoXwvGQ== X-Received: by 2002:a05:600c:a43:b0:459:a1c7:99ad with SMTP id 5b1f17b1804b1-45a21839edbmr12813255e9.22.1755251246585; Fri, 15 Aug 2025 02:47:26 -0700 (PDT) Received: from localhost.localdomain ([2a00:6d43:105:c401:e307:1a37:2e76:ce91]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45a209c25a1sm23241755e9.22.2025.08.15.02.47.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Aug 2025 02:47:25 -0700 (PDT) From: Marco Crivellari To: linux-kernel@vger.kernel.org Cc: Tejun Heo , Lai Jiangshan , Thomas Gleixner , Frederic Weisbecker , Sebastian Andrzej Siewior , Marco Crivellari , Michal Hocko , Alexander Viro , Christian Brauner Subject: [PATCH 1/2] Workqueue: fs: replace use of system_wq with system_percpu_wq Date: Fri, 15 Aug 2025 11:47:14 +0200 Message-ID: <20250815094715.54121-2-marco.crivellari@suse.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250815094715.54121-1-marco.crivellari@suse.com> References: <20250815094715.54121-1-marco.crivellari@suse.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Signed-off-by: Marco Crivellari --- fs/aio.c | 2 +- fs/fs-writeback.c | 2 +- fs/fuse/dev.c | 2 +- fs/fuse/inode.c | 2 +- fs/nfs/namespace.c | 2 +- fs/nfs/nfs4renewd.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/aio.c b/fs/aio.c index 7b976b564cfc..747e9b5bba23 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -636,7 +636,7 @@ static void free_ioctx_reqs(struct percpu_ref *ref) =20 /* Synchronize against RCU protected table->table[] dereferences */ INIT_RCU_WORK(&ctx->free_rwork, free_ioctx); - queue_rcu_work(system_wq, &ctx->free_rwork); + queue_rcu_work(system_percpu_wq, &ctx->free_rwork); } =20 /* diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index cc57367fb641..cf51a265bf27 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -2442,7 +2442,7 @@ static int dirtytime_interval_handler(const struct ct= l_table *table, int write, =20 ret =3D proc_dointvec_minmax(table, write, buffer, lenp, ppos); if (ret =3D=3D 0 && write) - mod_delayed_work(system_wq, &dirtytime_work, 0); + mod_delayed_work(system_percpu_wq, &dirtytime_work, 0); return ret; } =20 diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 6dcbaa218b7a..64b623471a09 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -118,7 +118,7 @@ void fuse_check_timeout(struct work_struct *work) goto abort_conn; =20 out: - queue_delayed_work(system_wq, &fc->timeout.work, + queue_delayed_work(system_percpu_wq, &fc->timeout.work, fuse_timeout_timer_freq); return; =20 diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index fd48e8d37f2e..6a608ea77d09 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -1268,7 +1268,7 @@ static void set_request_timeout(struct fuse_conn *fc,= unsigned int timeout) { fc->timeout.req_timeout =3D secs_to_jiffies(timeout); INIT_DELAYED_WORK(&fc->timeout.work, fuse_check_timeout); - queue_delayed_work(system_wq, &fc->timeout.work, + queue_delayed_work(system_percpu_wq, &fc->timeout.work, fuse_timeout_timer_freq); } =20 diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c index 973aed9cc5fe..0689369c8a63 100644 --- a/fs/nfs/namespace.c +++ b/fs/nfs/namespace.c @@ -336,7 +336,7 @@ static int param_set_nfs_timeout(const char *val, const= struct kernel_param *kp) num *=3D HZ; *((int *)kp->arg) =3D num; if (!list_empty(&nfs_automount_list)) - mod_delayed_work(system_wq, &nfs_automount_task, num); + mod_delayed_work(system_percpu_wq, &nfs_automount_task, num); } else { *((int *)kp->arg) =3D -1*HZ; cancel_delayed_work(&nfs_automount_task); diff --git a/fs/nfs/nfs4renewd.c b/fs/nfs/nfs4renewd.c index db3811af0796..18ae614e5a6c 100644 --- a/fs/nfs/nfs4renewd.c +++ b/fs/nfs/nfs4renewd.c @@ -122,7 +122,7 @@ nfs4_schedule_state_renewal(struct nfs_client *clp) timeout =3D 5 * HZ; dprintk("%s: requeueing work. Lease period =3D %ld\n", __func__, (timeout + HZ - 1) / HZ); - mod_delayed_work(system_wq, &clp->cl_renewd, timeout); + mod_delayed_work(system_percpu_wq, &clp->cl_renewd, timeout); set_bit(NFS_CS_RENEWD, &clp->cl_res_state); spin_unlock(&clp->cl_lock); } --=20 2.50.1 From nobody Sat Oct 4 14:36:14 2025 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A275D23D7F5 for ; Fri, 15 Aug 2025 09:47:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755251252; cv=none; b=ffmdfppKkIOj0t/WZw4ZaADpkwg6kr4DqxS5oyEN3OMWj44Q4Eup75Kr62IOIiwqfPlsE0EZCLT7TR8hUn3o+N84UoYFyipzlk58uFk06Lk/Er8zgI2dcBGMh2iYBYYxJygU5Hmg4D/w5iZDTKOCrx5BJxFLaPqiD1ux8p06u1o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755251252; c=relaxed/simple; bh=Sjltf4lbT1xeHxUqYYiGssqzD6gzaQw3aJ9n0Tvd8pQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pH6jBATat3ZxHbvg1kMrXUJATxoG0xY8QxeUweTskOBUpOihTc115GsjeHq++KsyIMryp15nRFBrBXBwj7ylHY3NZ1PqkRS0e3+Nwo4yE42i4j907QecHy6wllzci/IpBkU0WGxOjGKBxgr6qHXzDXAIMcjaKIbzup59udMPf8c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=fGh1deQC; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="fGh1deQC" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-45a1ac7c066so10240865e9.1 for ; Fri, 15 Aug 2025 02:47:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1755251248; x=1755856048; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IHgW/v2rphjPVW4+m0icKl7UCxz9a6G/MjNtmzOvLpY=; b=fGh1deQCUnBZSVISMVU+47NMHWlleDizPlh78ppAUXYaTi3/X5pOpad1Lnbq6vHHE1 bUpaH69H1jBWwUArx2GPUdIA9KKzfJ4M7VaZJ9zUmmJgYLa9Xss5P5MhunKLQJHPpa2J 8Y5yoLvV2rMDwY9lj0JNro4p8NA9tHpJq1ZvpBrKNRcK+JUZ+UZLLb2s5IDfgaeX8LG9 YgpmbQsoqWcwxUE8Kk2UwNrZexyb5ZyS12hEG4qh538VvUSJ2yV2MbfW3WsdaStPlhFJ fsHGcpGTRNnnuuft0DsvYMjG75pTWZoBS4LvJnssJ2hRowsdqCv3Yl4/0gTV7qWlVQqU /NUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755251248; x=1755856048; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IHgW/v2rphjPVW4+m0icKl7UCxz9a6G/MjNtmzOvLpY=; b=WnX9OUegi6hiixqHj5J8H3KyJLAFs2W1Z2i/A15XMUzolzILGuiKTzKfOUS8Otiuct phg6lItquBtofNwY2eSk5ndhPMzyCir/XjZhYC2C2qo1CmxBRteHjTeQ734vJYtEURZV v0VRJv7OpaRWSGBgyEHS3sEWjq9c3uhbMHGetMfWwvgSKebwW4DZvJnE/6U/E0iBiYHt J/JZxeWdB3tp5pCHfpFCTy7pFxBt2YTMRONEWl1DJg7Sa/ZPW9LuV7yZnrdfd3OOw95B k3uHffhlmCXdGc7H9F7E+/sMbAHSFcoXnq1cc0YpcvNxxz3hoPrdPv2IlHuJQ0hY+G55 BvvA== X-Gm-Message-State: AOJu0Yw+QY1lSV4u7uWaMo8zegO9Gv6V0d/KMuOQny8z5o50AvpK7O7E oA9jEz4fxlgAf5VGRonaO9/1vIHjD0brJ9l4TUF98YsiV6eRddH9+U5xVEaZJYquBL8yUtj7HfZ LB8Q3 X-Gm-Gg: ASbGncvPSh0D4b3baBS7rbQ6FlA+eC4fSi8cA9Kmo3ITya+qoeyUGPlIuUPAPF5etee EoIBntghaWAJxmFXRoA0v5AeZKqk6WvTTmfP/CIXWkE/ncvnGMi849unWYZIc3Z+Kob5nU8iCjo atv49fybXhk2n0lWTuAWkLIv/a9p3c33m8Js/mMTEwfpy5F3QenPcc4IQo0G+7kYbI8fZpGYVNc y1QrlNJ2myC+ynQhH5U2GKchVsRK/PRyzC4umcBKq+J0c1y+VTxuWnqd50y07snYQOWHhulCoAK dpdBjL4tjP27QAa5Sir8Ptr6jH+P2iSUCe/1ByGN6mptnqo0QCf8B9CfPs6quXigOX/55T34KGc MvG2bHazfgM6E/82AbPX/lh/gsmhBJU+n2wlyOIEQ7uJu2g== X-Google-Smtp-Source: AGHT+IHPDuN+irQhMdQ/bmAH5lirjP/2l9rpl6KQYiklLUgpb54ghtizrPhMAM+iD9kK9IhTjH9kaw== X-Received: by 2002:a05:600c:474a:b0:456:189e:223a with SMTP id 5b1f17b1804b1-45a2183e163mr12767425e9.10.1755251247757; Fri, 15 Aug 2025 02:47:27 -0700 (PDT) Received: from localhost.localdomain ([2a00:6d43:105:c401:e307:1a37:2e76:ce91]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45a209c25a1sm23241755e9.22.2025.08.15.02.47.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Aug 2025 02:47:27 -0700 (PDT) From: Marco Crivellari To: linux-kernel@vger.kernel.org Cc: Tejun Heo , Lai Jiangshan , Thomas Gleixner , Frederic Weisbecker , Sebastian Andrzej Siewior , Marco Crivellari , Michal Hocko , Alexander Viro , Christian Brauner Subject: [PATCH 2/2] Workqueue: fs: WQ_PERCPU added to alloc_workqueue users Date: Fri, 15 Aug 2025 11:47:15 +0200 Message-ID: <20250815094715.54121-3-marco.crivellari@suse.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250815094715.54121-1-marco.crivellari@suse.com> References: <20250815094715.54121-1-marco.crivellari@suse.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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. alloc_workqueue() treats all queues as per-CPU by default, while unbound workqueues must opt-in via WQ_UNBOUND. This default is suboptimal: most workloads benefit from unbound queues, allowing the scheduler to place worker threads where they=E2=80=99re needed= and reducing noise when CPUs are isolated. This default is suboptimal: most workloads benefit from unbound queues, allowing the scheduler to place worker threads where they=E2=80=99re needed= and reducing noise when CPUs are isolated. This patch adds a new WQ_PERCPU flag to all the fs subsystem users to explicitly request the use of the per-CPU behavior. Both flags coexist for one release cycle to allow callers to transition their calls. Once migration is complete, WQ_UNBOUND can be removed and unbound will become the implicit default. With the introduction of the WQ_PERCPU flag (equivalent to !WQ_UNBOUND), any alloc_workqueue() caller that doesn=E2=80=99t explicitly specify WQ_UNB= OUND must now use WQ_PERCPU. All existing users have been updated accordingly. Suggested-by: Tejun Heo Signed-off-by: Marco Crivellari --- fs/afs/main.c | 4 ++-- fs/bcachefs/super.c | 10 +++++----- fs/btrfs/async-thread.c | 3 +-- fs/btrfs/disk-io.c | 2 +- fs/ceph/super.c | 2 +- fs/dlm/lowcomms.c | 2 +- fs/dlm/main.c | 2 +- fs/fs-writeback.c | 2 +- fs/gfs2/main.c | 5 +++-- fs/gfs2/ops_fstype.c | 6 ++++-- fs/ocfs2/dlm/dlmdomain.c | 3 ++- fs/ocfs2/dlmfs/dlmfs.c | 3 ++- fs/smb/client/cifsfs.c | 16 +++++++++++----- fs/smb/server/ksmbd_work.c | 2 +- fs/smb/server/transport_rdma.c | 3 ++- fs/super.c | 3 ++- fs/verity/verify.c | 2 +- fs/xfs/xfs_log.c | 3 +-- fs/xfs/xfs_mru_cache.c | 3 ++- fs/xfs/xfs_super.c | 15 ++++++++------- 20 files changed, 52 insertions(+), 39 deletions(-) diff --git a/fs/afs/main.c b/fs/afs/main.c index c845c5daaeba..6b7aab6abd78 100644 --- a/fs/afs/main.c +++ b/fs/afs/main.c @@ -168,13 +168,13 @@ static int __init afs_init(void) =20 printk(KERN_INFO "kAFS: Red Hat AFS client v0.1 registering.\n"); =20 - afs_wq =3D alloc_workqueue("afs", 0, 0); + afs_wq =3D alloc_workqueue("afs", WQ_PERCPU, 0); if (!afs_wq) goto error_afs_wq; afs_async_calls =3D alloc_workqueue("kafsd", WQ_MEM_RECLAIM | WQ_UNBOUND,= 0); if (!afs_async_calls) goto error_async; - afs_lock_manager =3D alloc_workqueue("kafs_lockd", WQ_MEM_RECLAIM, 0); + afs_lock_manager =3D alloc_workqueue("kafs_lockd", WQ_MEM_RECLAIM | WQ_PE= RCPU, 0); if (!afs_lock_manager) goto error_lockmgr; =20 diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c index a58edde43bee..8bba5347a36e 100644 --- a/fs/bcachefs/super.c +++ b/fs/bcachefs/super.c @@ -909,15 +909,15 @@ static struct bch_fs *bch2_fs_alloc(struct bch_sb *sb= , struct bch_opts opts) if (!(c->btree_update_wq =3D alloc_workqueue("bcachefs", WQ_HIGHPRI|WQ_FREEZABLE|WQ_MEM_RECLAIM|WQ_UNBOUND, 512)) || !(c->btree_io_complete_wq =3D alloc_workqueue("bcachefs_btree_io", - WQ_HIGHPRI|WQ_FREEZABLE|WQ_MEM_RECLAIM, 1)) || + WQ_HIGHPRI | WQ_FREEZABLE | WQ_MEM_RECLAIM | WQ_PERCPU, 1)) || !(c->copygc_wq =3D alloc_workqueue("bcachefs_copygc", - WQ_HIGHPRI|WQ_FREEZABLE|WQ_MEM_RECLAIM|WQ_CPU_INTENSIVE, 1)) || + WQ_HIGHPRI | WQ_FREEZABLE | WQ_MEM_RECLAIM | WQ_CPU_INTENSIVE | WQ_PER= CPU, 1)) || !(c->btree_read_complete_wq =3D alloc_workqueue("bcachefs_btree_read_= complete", - WQ_HIGHPRI|WQ_FREEZABLE|WQ_MEM_RECLAIM, 512)) || + WQ_HIGHPRI | WQ_FREEZABLE | WQ_MEM_RECLAIM | WQ_PERCPU, 512)) || !(c->btree_write_submit_wq =3D alloc_workqueue("bcachefs_btree_write_= sumit", - WQ_HIGHPRI|WQ_FREEZABLE|WQ_MEM_RECLAIM, 1)) || + WQ_HIGHPRI | WQ_FREEZABLE | WQ_MEM_RECLAIM | WQ_PERCPU, 1)) || !(c->write_ref_wq =3D alloc_workqueue("bcachefs_write_ref", - WQ_FREEZABLE, 0)) || + WQ_FREEZABLE | WQ_PERCPU, 0)) || #ifndef BCH_WRITE_REF_DEBUG percpu_ref_init(&c->writes, bch2_writes_disabled, PERCPU_REF_INIT_DEAD, GFP_KERNEL) || diff --git a/fs/btrfs/async-thread.c b/fs/btrfs/async-thread.c index f3bffe08b290..0a84d86a942d 100644 --- a/fs/btrfs/async-thread.c +++ b/fs/btrfs/async-thread.c @@ -109,8 +109,7 @@ struct btrfs_workqueue *btrfs_alloc_workqueue(struct bt= rfs_fs_info *fs_info, ret->thresh =3D thresh; } =20 - ret->normal_wq =3D alloc_workqueue("btrfs-%s", flags, ret->current_active, - name); + ret->normal_wq =3D alloc_workqueue("btrfs-%s", flags, ret->current_active= , name); if (!ret->normal_wq) { kfree(ret); return NULL; diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 3dd555db3d32..f817b29a43de 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -1963,7 +1963,7 @@ static int btrfs_init_workqueues(struct btrfs_fs_info= *fs_info) { u32 max_active =3D fs_info->thread_pool_size; unsigned int flags =3D WQ_MEM_RECLAIM | WQ_FREEZABLE | WQ_UNBOUND; - unsigned int ordered_flags =3D WQ_MEM_RECLAIM | WQ_FREEZABLE; + unsigned int ordered_flags =3D WQ_MEM_RECLAIM | WQ_FREEZABLE | WQ_PERCPU; =20 fs_info->workers =3D btrfs_alloc_workqueue(fs_info, "worker", flags, max_active, 16); diff --git a/fs/ceph/super.c b/fs/ceph/super.c index f3951253e393..a0302a004157 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c @@ -862,7 +862,7 @@ static struct ceph_fs_client *create_fs_client(struct c= eph_mount_options *fsopt, fsc->inode_wq =3D alloc_workqueue("ceph-inode", WQ_UNBOUND, 0); if (!fsc->inode_wq) goto fail_client; - fsc->cap_wq =3D alloc_workqueue("ceph-cap", 0, 1); + fsc->cap_wq =3D alloc_workqueue("ceph-cap", WQ_PERCPU, 1); if (!fsc->cap_wq) goto fail_inode_wq; =20 diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index 70abd4da17a6..6ced1fa90209 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c @@ -1702,7 +1702,7 @@ static int work_start(void) return -ENOMEM; } =20 - process_workqueue =3D alloc_workqueue("dlm_process", WQ_HIGHPRI | WQ_BH, = 0); + process_workqueue =3D alloc_workqueue("dlm_process", WQ_HIGHPRI | WQ_BH |= WQ_PERCPU, 0); if (!process_workqueue) { log_print("can't start dlm_process"); destroy_workqueue(io_workqueue); diff --git a/fs/dlm/main.c b/fs/dlm/main.c index 4887c8a05318..a44d16da7187 100644 --- a/fs/dlm/main.c +++ b/fs/dlm/main.c @@ -52,7 +52,7 @@ static int __init init_dlm(void) if (error) goto out_user; =20 - dlm_wq =3D alloc_workqueue("dlm_wq", 0, 0); + dlm_wq =3D alloc_workqueue("dlm_wq", WQ_PERCPU, 0); if (!dlm_wq) { error =3D -ENOMEM; goto out_plock; diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index cf51a265bf27..4b1a53a3266b 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -1180,7 +1180,7 @@ void cgroup_writeback_umount(struct super_block *sb) =20 static int __init cgroup_writeback_init(void) { - isw_wq =3D alloc_workqueue("inode_switch_wbs", 0, 0); + isw_wq =3D alloc_workqueue("inode_switch_wbs", WQ_PERCPU, 0); if (!isw_wq) return -ENOMEM; return 0; diff --git a/fs/gfs2/main.c b/fs/gfs2/main.c index 0727f60ad028..9d65719353fa 100644 --- a/fs/gfs2/main.c +++ b/fs/gfs2/main.c @@ -151,7 +151,8 @@ static int __init init_gfs2_fs(void) =20 error =3D -ENOMEM; gfs2_recovery_wq =3D alloc_workqueue("gfs2_recovery", - WQ_MEM_RECLAIM | WQ_FREEZABLE, 0); + WQ_MEM_RECLAIM | WQ_FREEZABLE | WQ_PERCPU, + 0); if (!gfs2_recovery_wq) goto fail_wq1; =20 @@ -160,7 +161,7 @@ static int __init init_gfs2_fs(void) if (!gfs2_control_wq) goto fail_wq2; =20 - gfs2_freeze_wq =3D alloc_workqueue("gfs2_freeze", 0, 0); + gfs2_freeze_wq =3D alloc_workqueue("gfs2_freeze", WQ_PERCPU, 0); =20 if (!gfs2_freeze_wq) goto fail_wq3; diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index e83d293c3614..0dccb5882ef6 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c @@ -1189,13 +1189,15 @@ static int gfs2_fill_super(struct super_block *sb, = struct fs_context *fc) =20 error =3D -ENOMEM; sdp->sd_glock_wq =3D alloc_workqueue("gfs2-glock/%s", - WQ_MEM_RECLAIM | WQ_HIGHPRI | WQ_FREEZABLE, 0, + WQ_MEM_RECLAIM | WQ_HIGHPRI | WQ_FREEZABLE | WQ_PERCPU, + 0, sdp->sd_fsname); if (!sdp->sd_glock_wq) goto fail_free; =20 sdp->sd_delete_wq =3D alloc_workqueue("gfs2-delete/%s", - WQ_MEM_RECLAIM | WQ_FREEZABLE, 0, sdp->sd_fsname); + WQ_MEM_RECLAIM | WQ_FREEZABLE | WQ_PERCPU, 0, + sdp->sd_fsname); if (!sdp->sd_delete_wq) goto fail_glock_wq; =20 diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c index 2018501b2249..2347a50f079b 100644 --- a/fs/ocfs2/dlm/dlmdomain.c +++ b/fs/ocfs2/dlm/dlmdomain.c @@ -1876,7 +1876,8 @@ static int dlm_join_domain(struct dlm_ctxt *dlm) dlm_debug_init(dlm); =20 snprintf(wq_name, O2NM_MAX_NAME_LEN, "dlm_wq-%s", dlm->name); - dlm->dlm_worker =3D alloc_workqueue(wq_name, WQ_MEM_RECLAIM, 0); + dlm->dlm_worker =3D alloc_workqueue(wq_name, WQ_MEM_RECLAIM | WQ_PERCPU, + 0); if (!dlm->dlm_worker) { status =3D -ENOMEM; mlog_errno(status); diff --git a/fs/ocfs2/dlmfs/dlmfs.c b/fs/ocfs2/dlmfs/dlmfs.c index 5130ec44e5e1..0b730535b2c8 100644 --- a/fs/ocfs2/dlmfs/dlmfs.c +++ b/fs/ocfs2/dlmfs/dlmfs.c @@ -595,7 +595,8 @@ static int __init init_dlmfs_fs(void) } cleanup_inode =3D 1; =20 - user_dlm_worker =3D alloc_workqueue("user_dlm", WQ_MEM_RECLAIM, 0); + user_dlm_worker =3D alloc_workqueue("user_dlm", + WQ_MEM_RECLAIM | WQ_PERCPU, 0); if (!user_dlm_worker) { status =3D -ENOMEM; goto bail; diff --git a/fs/smb/client/cifsfs.c b/fs/smb/client/cifsfs.c index a08c42363ffc..3d3a76fa7210 100644 --- a/fs/smb/client/cifsfs.c +++ b/fs/smb/client/cifsfs.c @@ -1883,7 +1883,9 @@ init_cifs(void) cifs_dbg(VFS, "dir_cache_timeout set to max of 65000 seconds\n"); } =20 - cifsiod_wq =3D alloc_workqueue("cifsiod", WQ_FREEZABLE|WQ_MEM_RECLAIM, 0); + cifsiod_wq =3D alloc_workqueue("cifsiod", + WQ_FREEZABLE | WQ_MEM_RECLAIM | WQ_PERCPU, + 0); if (!cifsiod_wq) { rc =3D -ENOMEM; goto out_clean_proc; @@ -1911,28 +1913,32 @@ init_cifs(void) } =20 cifsoplockd_wq =3D alloc_workqueue("cifsoplockd", - WQ_FREEZABLE|WQ_MEM_RECLAIM, 0); + WQ_FREEZABLE | WQ_MEM_RECLAIM | WQ_PERCPU, + 0); if (!cifsoplockd_wq) { rc =3D -ENOMEM; goto out_destroy_fileinfo_put_wq; } =20 deferredclose_wq =3D alloc_workqueue("deferredclose", - WQ_FREEZABLE|WQ_MEM_RECLAIM, 0); + WQ_FREEZABLE | WQ_MEM_RECLAIM | WQ_PERCPU, + 0); if (!deferredclose_wq) { rc =3D -ENOMEM; goto out_destroy_cifsoplockd_wq; } =20 serverclose_wq =3D alloc_workqueue("serverclose", - WQ_FREEZABLE|WQ_MEM_RECLAIM, 0); + WQ_FREEZABLE | WQ_MEM_RECLAIM | WQ_PERCPU, + 0); if (!serverclose_wq) { rc =3D -ENOMEM; goto out_destroy_deferredclose_wq; } =20 cfid_put_wq =3D alloc_workqueue("cfid_put_wq", - WQ_FREEZABLE|WQ_MEM_RECLAIM, 0); + WQ_FREEZABLE | WQ_MEM_RECLAIM | WQ_PERCPU, + 0); if (!cfid_put_wq) { rc =3D -ENOMEM; goto out_destroy_serverclose_wq; diff --git a/fs/smb/server/ksmbd_work.c b/fs/smb/server/ksmbd_work.c index 72b00ca6e455..4a71f46d7020 100644 --- a/fs/smb/server/ksmbd_work.c +++ b/fs/smb/server/ksmbd_work.c @@ -78,7 +78,7 @@ int ksmbd_work_pool_init(void) =20 int ksmbd_workqueue_init(void) { - ksmbd_wq =3D alloc_workqueue("ksmbd-io", 0, 0); + ksmbd_wq =3D alloc_workqueue("ksmbd-io", WQ_PERCPU, 0); if (!ksmbd_wq) return -ENOMEM; return 0; diff --git a/fs/smb/server/transport_rdma.c b/fs/smb/server/transport_rdma.c index 4998df04ab95..43b7062335fa 100644 --- a/fs/smb/server/transport_rdma.c +++ b/fs/smb/server/transport_rdma.c @@ -2198,7 +2198,8 @@ int ksmbd_rdma_init(void) * for lack of credits */ smb_direct_wq =3D alloc_workqueue("ksmbd-smb_direct-wq", - WQ_HIGHPRI | WQ_MEM_RECLAIM, 0); + WQ_HIGHPRI | WQ_MEM_RECLAIM | WQ_PERCPU, + 0); if (!smb_direct_wq) return -ENOMEM; =20 diff --git a/fs/super.c b/fs/super.c index 97a17f9d9023..0a9af48f30dd 100644 --- a/fs/super.c +++ b/fs/super.c @@ -2174,7 +2174,8 @@ int sb_init_dio_done_wq(struct super_block *sb) { struct workqueue_struct *old; struct workqueue_struct *wq =3D alloc_workqueue("dio/%s", - WQ_MEM_RECLAIM, 0, + WQ_MEM_RECLAIM | WQ_PERCPU, + 0, sb->s_id); if (!wq) return -ENOMEM; diff --git a/fs/verity/verify.c b/fs/verity/verify.c index 4fcad0825a12..b8f53d1cfd20 100644 --- a/fs/verity/verify.c +++ b/fs/verity/verify.c @@ -357,7 +357,7 @@ void __init fsverity_init_workqueue(void) * latency on ARM64. */ fsverity_read_workqueue =3D alloc_workqueue("fsverity_read_queue", - WQ_HIGHPRI, + WQ_HIGHPRI | WQ_PERCPU, num_online_cpus()); if (!fsverity_read_workqueue) panic("failed to allocate fsverity_read_queue"); diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index 6493bdb57351..3fecb066eeb3 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c @@ -1489,8 +1489,7 @@ xlog_alloc_log( log->l_iclog->ic_prev =3D prev_iclog; /* re-write 1st prev ptr */ =20 log->l_ioend_workqueue =3D alloc_workqueue("xfs-log/%s", - XFS_WQFLAGS(WQ_FREEZABLE | WQ_MEM_RECLAIM | - WQ_HIGHPRI), + XFS_WQFLAGS(WQ_FREEZABLE | WQ_MEM_RECLAIM | WQ_HIGHPRI | WQ_PERCPU), 0, mp->m_super->s_id); if (!log->l_ioend_workqueue) goto out_free_iclog; diff --git a/fs/xfs/xfs_mru_cache.c b/fs/xfs/xfs_mru_cache.c index d0f5b403bdbe..152032f68013 100644 --- a/fs/xfs/xfs_mru_cache.c +++ b/fs/xfs/xfs_mru_cache.c @@ -293,7 +293,8 @@ int xfs_mru_cache_init(void) { xfs_mru_reap_wq =3D alloc_workqueue("xfs_mru_cache", - XFS_WQFLAGS(WQ_MEM_RECLAIM | WQ_FREEZABLE), 1); + XFS_WQFLAGS(WQ_MEM_RECLAIM | WQ_FREEZABLE | WQ_PERCPU), + 1); if (!xfs_mru_reap_wq) return -ENOMEM; return 0; diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index b2dd0c0bf509..38584c5618f4 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -565,19 +565,19 @@ xfs_init_mount_workqueues( struct xfs_mount *mp) { mp->m_buf_workqueue =3D alloc_workqueue("xfs-buf/%s", - XFS_WQFLAGS(WQ_FREEZABLE | WQ_MEM_RECLAIM), + XFS_WQFLAGS(WQ_FREEZABLE | WQ_MEM_RECLAIM | WQ_PERCPU), 1, mp->m_super->s_id); if (!mp->m_buf_workqueue) goto out; =20 mp->m_unwritten_workqueue =3D alloc_workqueue("xfs-conv/%s", - XFS_WQFLAGS(WQ_FREEZABLE | WQ_MEM_RECLAIM), + XFS_WQFLAGS(WQ_FREEZABLE | WQ_MEM_RECLAIM | WQ_PERCPU), 0, mp->m_super->s_id); if (!mp->m_unwritten_workqueue) goto out_destroy_buf; =20 mp->m_reclaim_workqueue =3D alloc_workqueue("xfs-reclaim/%s", - XFS_WQFLAGS(WQ_FREEZABLE | WQ_MEM_RECLAIM), + XFS_WQFLAGS(WQ_FREEZABLE | WQ_MEM_RECLAIM | WQ_PERCPU), 0, mp->m_super->s_id); if (!mp->m_reclaim_workqueue) goto out_destroy_unwritten; @@ -589,13 +589,14 @@ xfs_init_mount_workqueues( goto out_destroy_reclaim; =20 mp->m_inodegc_wq =3D alloc_workqueue("xfs-inodegc/%s", - XFS_WQFLAGS(WQ_FREEZABLE | WQ_MEM_RECLAIM), + XFS_WQFLAGS(WQ_FREEZABLE | WQ_MEM_RECLAIM | WQ_PERCPU), 1, mp->m_super->s_id); if (!mp->m_inodegc_wq) goto out_destroy_blockgc; =20 mp->m_sync_workqueue =3D alloc_workqueue("xfs-sync/%s", - XFS_WQFLAGS(WQ_FREEZABLE), 0, mp->m_super->s_id); + XFS_WQFLAGS(WQ_FREEZABLE | WQ_PERCPU), 0, + mp->m_super->s_id); if (!mp->m_sync_workqueue) goto out_destroy_inodegc; =20 @@ -2499,8 +2500,8 @@ xfs_init_workqueues(void) * AGs in all the filesystems mounted. Hence use the default large * max_active value for this workqueue. */ - xfs_alloc_wq =3D alloc_workqueue("xfsalloc", - XFS_WQFLAGS(WQ_MEM_RECLAIM | WQ_FREEZABLE), 0); + xfs_alloc_wq =3D alloc_workqueue("xfsalloc", XFS_WQFLAGS(WQ_MEM_RECLAIM |= WQ_FREEZABLE | WQ_PERCPU), + 0); if (!xfs_alloc_wq) return -ENOMEM; =20 --=20 2.50.1