public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/2] workqueue: Introduce PF_WQ_RESCUE_WORKER
@ 2023-07-29 13:53 Aaron Tomlin
  2023-07-29 13:53 ` [RFC PATCH 1/2] " Aaron Tomlin
                   ` (3 more replies)
  0 siblings, 4 replies; 25+ messages in thread
From: Aaron Tomlin @ 2023-07-29 13:53 UTC (permalink / raw)
  To: linux-kernel; +Cc: tj, jiangshanlai, peterz

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(-)

-- 
2.39.1


^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2023-12-19  8:55 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-29 13:53 [RFC PATCH 0/2] workqueue: Introduce PF_WQ_RESCUE_WORKER Aaron Tomlin
2023-07-29 13:53 ` [RFC PATCH 1/2] " Aaron Tomlin
2023-07-29 16:07   ` Peter Zijlstra
2023-08-01 10:04     ` Aaron Tomlin
2023-07-29 13:53 ` [RFC PATCH 2/2] workqueue: Simplify current_is_workqueue_rescuer() Aaron Tomlin
2023-07-31 23:35 ` [RFC PATCH 0/2] workqueue: Introduce PF_WQ_RESCUE_WORKER Tejun Heo
2023-08-01 10:53   ` Aaron Tomlin
2023-08-02 18:10     ` Tejun Heo
2023-08-03 20:19       ` Aaron Tomlin
2023-08-03 20:34         ` Tejun Heo
2023-08-05 23:45           ` Aaron Tomlin
2023-12-11 14:51 ` Juri Lelli
2023-12-11 18:39   ` Tejun Heo
2023-12-12  9:56     ` Juri Lelli
2023-12-12 17:14       ` Tejun Heo
2023-12-12 19:06         ` Aaron Tomlin
2023-12-12 20:16           ` Tejun Heo
2023-12-13  8:59         ` Juri Lelli
2023-12-13 15:35           ` Tejun Heo
2023-12-13 18:32             ` Juri Lelli
2023-12-13 18:38               ` Tejun Heo
2023-12-14 11:25                 ` Juri Lelli
2023-12-14 19:47                   ` Tejun Heo
2023-12-15  6:50                     ` Juri Lelli
2023-12-19  8:55                       ` Juri Lelli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox