Linuxsources
cregit.linuxsources.org › code › 4.7 › kernel › workqueue.c.html
kernel/workqueue.c · cregit-Linux
This never recurses on the same * pool->lock as this path is taken only for unbound workqueues and * the release work item is scheduled on a per-cpu workqueue. To * avoid lockdep warning, unbound pool->locks are given lockdep * subclass of 1 in get_unbound_pool().
GitHub
github.com › torvalds › linux › blob › master › kernel › workqueue.c
linux/kernel/workqueue.c at master · torvalds/linux
static struct workqueue_attrs *ordered_wq_attrs[NR_STD_WORKER_POOLS]; · /* * I: kthread_worker to release pwq's. pwq release needs to be bounced to a · * process context while holding a pool lock. Bounce to a dedicated kthread · * worker to avoid A-A deadlocks.
Author torvalds
Linux Kernel
docs.kernel.org › core-api › workqueue.html
Workqueue — The Linux Kernel documentation
The cmwq design differentiates between the user-facing workqueues that subsystems and drivers queue work items on and the backend mechanism which manages worker-pools and processes the queued work items.
GitHub
github.com › torvalds › linux › blob › 16f73eb02d7e1765ccab3d2018e0bd98eb93d973 › kernel › workqueue.c
linux/kernel/workqueue.c at 16f73eb02d7e1765ccab3d2018e0bd98eb93d973 · torvalds/linux
static void process_one_work(struct worker *worker, struct work_struct *work) __releases(&pool->lock) __acquires(&pool->lock) { struct pool_workqueue *pwq = get_work_pwq(work); struct worker_pool *pool = worker->pool; bool cpu_intensive = pwq->wq->flags & WQ_CPU_INTENSIVE; int work_color; struct worker *collision; #ifdef CONFIG_LOCKDEP ·
Author torvalds
Linux Kernel
docs.huihoo.com › doxygen › linux › kernel › 3.7 › workqueue_8c_source.html
Linux Kernel: kernel/workqueue.c Source File - Huihoo
2142 mutex_unlock(&pool->assoc_mutex); 2143 return ret; 2144 } 2145 · 2160 static void process_one_work(struct worker *worker, struct work_struct *work) 2161 __releases(&gcwq->lock) 2162 __acquires(&gcwq->lock) 2163 { 2164 struct cpu_workqueue_struct *cwq = get_work_cwq(work); 2165 struct worker_pool *pool = worker->pool; 2166 struct global_cwq *gcwq = pool->gcwq; 2167 struct hlist_head *bwh = busy_worker_head(gcwq, work); 2168 bool cpu_intensive = cwq->wq->flags & WQ_CPU_INTENSIVE; 2169 work_func_t f = work->func; 2170 int work_color; 2171 struct worker *collision; 2172 #ifdef CONFIG_LOCKDEP ·
Google Source
kernel.googlesource.com › pub › scm › linux › kernel › git › torvalds › linux › + › 19ec50a438c2ea3e370f6d453bf2f2e6e45ef72b › Documentation › core-api › workqueue.rst
Documentation/core-api/workqueue.rst - pub/scm/linux/kernel/git/torvalds/linux - Git at Google
kernel / pub / scm / linux / kernel / git / torvalds / linux / 19ec50a438c2ea3e370f6d453bf2f2e6e45ef72b / . / Documentation / core-api / workqueue.rst
Linux Kernel
kernel.org › doc › html › v4.15 › core-api › workqueue.html
Concurrency Managed Workqueue (cmwq) — The Linux Kernel documentation
There are two worker-pools, one for normal work items and the other for high priority ones, for each possible CPU and some extra worker-pools to serve work items queued on unbound workqueues - the number of these backing pools is dynamic. Subsystems and drivers can create and queue work items through special workqueue API functions as they see fit. They can influence some aspects of the way the work items are executed by setting flags on the workqueue they are putting the work item on.
Linux Kernel
kernel.org › doc › Documentation › core-api › workqueue.rst
========= Workqueue ========= :Date: September, 2010
If no work is queued, the worker threads become idle. These worker threads are managed in worker-pools. The cmwq design differentiates between the user-facing workqueues that subsystems and drivers queue work items on and the backend mechanism which manages worker-pools and processes the queued ...
Infradead
infradead.org › ~mchehab › kernel_docs › core-api › workqueue.html
Concurrency Managed Workqueue (cmwq) — The Linux Kernel 5.10.0-rc1+ documentation
The cmwq design differentiates between the user-facing workqueues that subsystems and drivers queue work items on and the backend mechanism which manages worker-pools and processes the queued work items.
Linux Kernel Labs
linux-kernel-labs.github.io › refs › heads › master › labs › deferred_work.html
Deferred work — The Linux Kernel documentation
The kernel will initialize a kernel thread (or a pool of workers) for each processor present in the system: $ ps -e PID TTY TIME CMD 1? 00:00:00 init 2 ? 00:00:00 ksoftirqd / 0 3 ? 00:00:00 events / 0 <--- kernel thread that runs work items 4 ? 00:00:00 khelper 5 ? 00:00:00 kthread 7? 00:00:00 kblockd / 0 8? 00:00:00 kacpid · The above functions use a predefined workqueue ...
Kernel-internals
kernel-internals.org › interrupts › workqueues
Workqueues - Linux Kernel Internals
Unlike softirqs and tasklets, workqueue handlers run in process context — they can sleep, take mutexes, do memory allocation with GFP_KERNEL, and perform any operation that's valid in a kernel thread. The kernel automatically manages a pool of worker threads. Each work item is queued and run when a worker becomes available. #include <linux/workqueue.h> /* Define a work item and its handler */ struct my_device { struct work_struct work; /* one-shot work */ struct delayed_work dwork; /* delayed work */ }; /* Work handler: runs in process context */ static void my_work_handler(struct work_struc
LWN.net
lwn.net › Articles › 355700
Concurrency-managed workqueues [LWN.net]
October 7, 2009 - Our strength is writing the kind of articles that developers, administrators, and free-software supporters depend on to know what is going on in the Linux world. Please subscribe today to help us keep doing that, and so we don’t have to get good at marketing. By Jonathan Corbet October 7, 2009 A "thread pool" is a common group of processes which can be called on to perform work at some future time. The kernel does not lack for thread pool implementations; indeed, there are more choices than one might like. Options include workqueues, the slow work mechanism, and asynchronous function calls - not to mention various private thread pool implementations found elsewhere in the kernel.
Phoronix
phoronix.com › news › Linux-6.13-Workqueues
Linux 6.13 Quadrupling Workqueue Concurrency Limit - Phoronix
As consecutive CPUs are likely to be pointing to the same worker pool, reduce overhead by switching locks only when necessary." These WQ changes are now pending for the Linux 6.13 merge window. ... Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics.
O'Reilly
oreilly.com › library › view › understanding-the-linux › 0596005652 › ch04s08.html
4.8. Work Queues - Understanding the Linux Kernel, 3rd Edition [Book]
November 17, 2005 - In fact, a deferrable function cannot make any assumption about the process that is currently running when it is executed. On the other hand, a function in a work queue is executed by a kernel thread, so there is no User Mode address space to access. The main data structure associated with a work queue is a descriptor called workqueue_struct, which contains, among other things, an array of NR_CPUS elements, the maximum number of CPUs in the system.[*] Each element is a descriptor of type cpu_workqueue_struct, whose fields are shown in ...
Authors Daniel P. BovetMarco Cesati
Published 2005
Pages 942
Linux Man Pages
linux.die.net › man › 3 › pool
pool(3): Load Distribution Facility - Linux man page
The BIF statistics(run_queue) is used for estimating future loads. It returns the length of the queue of ready to run processes in the Erlang runtime system. The slave nodes are started with the slave module. This effects, tty IO, file IO, and code loading. If the master node fails, the entire pool will exit.
Paper Checker
hub.paper-checker.com › blog › multitasking-in-the-linux-kernel-an-in-depth-guide-to-workqueues
Multitasking in Linux Kernel: Exploring Workqueues
January 16, 2025 - Thread Pool Management: Worker threads are pooled to avoid the overhead of creating and destroying threads repeatedly. Flexible Scheduling: Workqueues can execute tasks in different contexts, including normal or high-priority scheduling. Workqueue Structure: Represents a queue for holding tasks. Work Structure (struct work_struct): Defines a specific task to be executed. Worker Threads: Kernel threads responsible for processing tasks from the workqueue.
Reddit
reddit.com › r/linuxquestions › bug: workqueue lockup
r/linuxquestions on Reddit: BUG: workqueue lockup
January 16, 2024 -
Hello r/linuxquestions,
My server recently started incrementing this message:
Message from syslogd@myservername at Jan 16 11:53:49 ... kernel:[17952083.819309] BUG: workqueue lockup - pool cpus=4 node=0 flags=0x0 nice=0 stuck for 202122s!
Neither I or my end-users are seeing any issues. My cronjobs are running smoothly, my endusers are able run their applications, however these messages keep filling my shell/CLI every 10 seconds making my CLI very difficult to use.
Any suggestions on how to go about fixing this issue? Thanks!
Top answer 1 of 2
1
The queue the system uses for asynchronous events locked and isn't processing them. Odds are things will work fine (with that error) for some indeterminate period of time and then the whole system will halt. Odds are the only way to fix it is with a reboot, though since you didn't note your kernel version there's no way to investigate the cause or see if it has been fixed.
2 of 2
1
Looks like a kernel bug. Update it if possible.
Python
docs.python.org › 3 › library › multiprocessing.html
multiprocessing — Process-based parallelism
Server process managers are more flexible than using shared memory objects because they can be made to support arbitrary object types. Also, a single manager can be shared by processes on different computers over a network. They are, however, slower than using shared memory. The Pool class represents a pool of worker processes.