[RFC,2/2] workqueue: Simplify current_is_workqueue_rescuer()

Message ID 20230729135334.566138-3-atomlin@atomlin.com
State New
Headers
Series workqueue: Introduce PF_WQ_RESCUE_WORKER |

Commit Message

Aaron Tomlin July 29, 2023, 1:53 p.m. UTC
  No functional change.

This patch simplifies current_is_workqueue_rescuer()
due to the addition of PF_WQ_RESCUE_WORKER.

Signed-off-by: Aaron Tomlin <atomlin@atomlin.com>
---
 kernel/workqueue.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Patch

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 6d38d714b72b..3b7a4d60cb6a 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -4890,9 +4890,9 @@  EXPORT_SYMBOL(current_work);
  */
 bool current_is_workqueue_rescuer(void)
 {
-	struct worker *worker = current_wq_worker();
-
-	return worker && worker->rescue_wq;
+	if (in_task() && (current->flags & PF_WQ_RESCUE_WORKER))
+		return true;
+	return false;
 }
 
 /**