Skip to content

RFC workqueue: Fix for prematurely wakeups and cleanups

Lai Jiangshan linux-mm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest8 patches 7 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8workqueue: Unconditionally set cpumask in worker_attach_to_pool()kernel/workqueue.c+5 -23 replies
2/8workqueue: Make create_worker() safe against prematurely wakeupskernel/workqueue.c kernel/workqueue_internal.h+23 -104 replies
3/8workqueue: Set PF_NO_SETAFFINITY instead of kthread_bind_mask()kernel/workqueue.c+3 -20 replies
4/8workqueue: Set/Clear PF_WQ_WORKER while attaching/detachingkernel/workqueue.c+12 -200 replies
5/8workqueue: Use worker_set_flags() in worker_enter_idle()kernel/workqueue.c+1 -20 replies
6/8workqueue: Simplify the starting of the newly created workerkernel/workqueue.c+17 -180 replies
7/8workqueue: Remove the outer loop in maybe_create_worker()kernel/workqueue.c+0 -153 replies
8/8workqueue: Move the locking out of maybe_create_worker()kernel/workqueue.c+3 -90 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/8] workqueue: Fix for prematurely wakeups and cleanups

From: Lai Jiangshan <[email protected]>

Patch1-3 are fixes for prematurely wakeups and patch4-8 are cleanups.

Patch2 fixes when prematurely wakeup happens after kthread_bind_mask(). Patch3 fixes when prematurely wakeup happens before kthread_bind_mask(). Patch1 prepares for patch2-3.

Like Petr's patch[1], a completion is introduced to do the synchronization, but the synchronization is done in a different direction which allows the newly created worker itself do some initialization instead of the manager and allows for a more simplified code.
(The changed synchronization direction is not necessarily better.)

And make workqueue code less dependence on the semantics that kthread provides.

[1]: https://lore.kernel.org/all/[email protected]/
Cc: Linus Torvalds <[email protected]>
Cc: "Eric W. Biederman" <[email protected]>
Cc: Tejun Heo <[email protected]>,
Cc: Petr Mladek <[email protected]>
Cc: Michal Hocko <[email protected]>,
Cc: Peter Zijlstra <[email protected]>,
Cc: Wedson Almeida Filho <[email protected]>

Lai Jiangshan (8):
workqueue: Unconditionally set cpumask in worker_attach_to_pool()
workqueue: Make create_worker() safe against prematurely wakeups
workqueue: Set PF_NO_SETAFFINITY instead of kthread_bind_mask()
workqueue: Set/Clear PF_WQ_WORKER while attaching/detaching
workqueue: Use worker_set_flags() in worker_enter_idle()
workqueue: Simplify the starting of the newly created worker
workqueue: Remove the outer loop in maybe_create_worker()
workqueue: Move the locking out of maybe_create_worker()

 kernel/workqueue.c          | 123 +++++++++++++++---------------------
 kernel/workqueue_internal.h |  11 +++-
 2 files changed, 60 insertions(+), 74 deletions(-)
Signature · 1 line
2.19.1.6.gb485710b