Skip to content

RFC workqueue: Introduce PF_WQ_RESCUE_WORKER

Aaron Tomlin lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest2 patches 22 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2workqueue: Introduce PF_WQ_RESCUE_WORKERinclude/linux/sched.h kernel/workqueue.c+13 -82 replies
2/2workqueue: Simplify current_is_workqueue_rescuer()kernel/workqueue.c+3 -30 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/2] workqueue: Introduce PF_WQ_RESCUE_WORKER

The Linux kernel does not provide a way to differentiate between a kworker and a rescue kworker for user-mode.
From user-mode, one can establish if a task is a kworker by testing for PF_WQ_WORKER in a specified task's flags bit mask (or bitmap) via /proc/[PID]/stat. Indeed, one can examine /proc/[PID]/stack and search for the function namely "rescuer_thread". This is only available to the root user.

It can be useful to identify a rescue kworker since their CPU affinity cannot be modified and their initial CPU assignment can be safely ignored. Furthermore, a workqueue that was created with WQ_MEM_RECLAIM and WQ_SYSFS the cpumask file is not applicable to the rescue kworker. By design a rescue kworker should run anywhere.

This patch series introduces PF_WQ_RESCUE_WORKER and ensures it is set and cleared appropriately and simplifies current_is_workqueue_rescuer().

Aaron Tomlin (2):
workqueue: Introduce PF_WQ_RESCUE_WORKER
workqueue: Simplify current_is_workqueue_rescuer()

 include/linux/sched.h |  2 +-
 kernel/workqueue.c    | 25 +++++++++++++++----------
 2 files changed, 16 insertions(+), 11 deletions(-)
Signature · 1 line
2.39.1