[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251205125445.4154667-1-jackzxcui1989@163.com>
Date: Fri, 5 Dec 2025 20:54:42 +0800
From: Xin Zhao <jackzxcui1989@....com>
To: tj@...nel.org,
jiangshanlai@...il.com
Cc: hch@...radead.org,
jackzxcui1989@....com,
linux-kernel@...r.kernel.org
Subject: [RFC PATCH 0/3] workqueue: Add configure to reduce work latency
In a system with high real-time requirements, we have noticed that many
high-priority tasks, such as kernel threads responsible for dispatching
GPU tasks and receiving data sources, often experience latency spikes
due to insufficient real-time execution of work.
The existing sysfs can adjust nice value for unbound workqueues. Add new
'policy' node to support three common policies: SCHED_NORMAL, SCHED_FIFO,
or SCHED_RR. The original 'nice' node is retained for compatibility, add
new 'rtprio' node to adjust real-time priority when 'policy' is SCHED_FIFO
or SCHED_RR. The value of 'rtprio' uses the same numerical meaning as user
space tool chrt.
Introduce variable 'nr_idle_extra', which allows user space to configure
unbound workqueue through sysfs according to the real-time requirement.
By default, workqueue created by system will set 'nr_idle_extra' to 0.
When the policy of workqueue is set to SCHED_FIFO or SCHED_RR via sysfs,
'nr_idle_extra' will be set to WORKER_NR_RT_DEF(2) as default.
Supporting the private configuration aims to deterministically ensure that
tasks within one workqueue are not affected by tasks from other workqueues
with the same attributes. If the user has high real-time requirements,
they can increase the nr_idle_extra supported in the previous patch while
also setting the workqueue 'private', allowing it to independently use
kworker threads, thus ensuring scheduling-related work delays never occur.
Xin Zhao (3):
workqueue: Support unbound RT workqueue by sysfs
workqueue: Introduce nr_idle_extra to reduce work tail latency
workqueue: Support private workqueue by sysfs
include/linux/workqueue.h | 32 ++++-
kernel/workqueue.c | 295 +++++++++++++++++++++++++++++++++-----
2 files changed, 290 insertions(+), 37 deletions(-)
--
2.34.1
Powered by blists - more mailing lists