* [PATCH] workqueue: Skip non-freezable workqueues in freeze and thaw
@ 2026-11-15 0:29 Samuel Wu
0 siblings, 0 replies; only message in thread
From: Samuel Wu @ 2026-11-15 0:29 UTC (permalink / raw)
To: Tejun Heo, Lai Jiangshan; +Cc: linux-pm, Samuel Wu, kernel-team, linux-kernel
In wq_adjust_max_active(), non-freezable workqueues always keep
saved_max_active and saved_min_active, so updating them during freeze
and thaw is a no-op. However, both freeze and thaw acquire mutexes and
adjust max_active for every wq on the wq list, which is extra work and
could increase contention.
Skip workqueues without WQ_FREEZABLE in freeze and thaw.
On a v7.3 Pixel 9 device, this consistently reduces thaw_processes
latency during system suspend by 4-5% (~0.7ms).
Signed-off-by: Samuel Wu <wusamuel@google.com>
---
kernel/workqueue.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index edbb2aa9c950..902f84bcfd24 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -7370,6 +7370,8 @@ void freeze_workqueues_begin(void)
workqueue_freezing = true;
list_for_each_entry(wq, &workqueues, list) {
+ if (!(wq->flags & WQ_FREEZABLE))
+ continue;
mutex_lock(&wq->mutex);
wq_adjust_max_active(wq);
mutex_unlock(&wq->mutex);
@@ -7446,6 +7448,8 @@ void thaw_workqueues(void)
/* restore max_active and repopulate worklist */
list_for_each_entry(wq, &workqueues, list) {
+ if (!(wq->flags & WQ_FREEZABLE))
+ continue;
mutex_lock(&wq->mutex);
wq_adjust_max_active(wq);
mutex_unlock(&wq->mutex);
--
2.56.0.679.gc527c65306-goog
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-15 0:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-15 0:29 [PATCH] workqueue: Skip non-freezable workqueues in freeze and thaw Samuel Wu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®