lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251125103126.684929-3-jiangshanlai@gmail.com>
Date: Tue, 25 Nov 2025 18:31:25 +0800
From: Lai Jiangshan <jiangshanlai@...il.com>
To: linux-kernel@...r.kernel.org
Cc: Tejun Heo <tj@...nel.org>,
	Lai Jiangshan <jiangshan.ljs@...group.com>,
	Lai Jiangshan <jiangshanlai@...il.com>
Subject: [PATCH 2/2] workqueue: Move flush color assignment code into insert_work()

From: Lai Jiangshan <jiangshan.ljs@...group.com>

Move the open code into insert_work() and simplify its callers.

Signed-off-by: Lai Jiangshan <jiangshan.ljs@...group.com>
---
 kernel/workqueue.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 4d817c7144cf..2654fbd481a1 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -2179,6 +2179,9 @@ static void insert_work(struct pool_workqueue *pwq, struct work_struct *work,
 	/* record the work call stack in order to print it in KASAN reports */
 	kasan_record_aux_stack(work);
 
+	pwq->nr_in_flight[pwq->work_color]++;
+	extra_flags |= work_color_to_flags(pwq->work_color);
+
 	/* we own @work, set data and link */
 	set_work_pwq(work, pwq, extra_flags);
 	list_add_tail(&work->entry, head);
@@ -2231,7 +2234,6 @@ static void __queue_work(int cpu, struct workqueue_struct *wq,
 {
 	struct pool_workqueue *pwq;
 	struct worker_pool *last_pool, *pool;
-	unsigned int work_flags;
 	unsigned int req_cpu = cpu;
 
 	/*
@@ -2319,9 +2321,6 @@ static void __queue_work(int cpu, struct workqueue_struct *wq,
 	if (WARN_ON(!list_empty(&work->entry)))
 		goto out;
 
-	pwq->nr_in_flight[pwq->work_color]++;
-	work_flags = work_color_to_flags(pwq->work_color);
-
 	/*
 	 * Limit the number of concurrently active work items to max_active.
 	 * @work must also queue behind existing inactive work items to maintain
@@ -2332,11 +2331,10 @@ static void __queue_work(int cpu, struct workqueue_struct *wq,
 			pool->watchdog_ts = jiffies;
 
 		trace_workqueue_activate_work(work);
-		insert_work(pwq, work, &pool->worklist, work_flags);
+		insert_work(pwq, work, &pool->worklist, 0);
 		kick_pool(pool);
 	} else {
-		work_flags |= WORK_STRUCT_INACTIVE;
-		insert_work(pwq, work, &pwq->inactive_works, work_flags);
+		insert_work(pwq, work, &pwq->inactive_works, WORK_STRUCT_INACTIVE);
 	}
 
 out:
@@ -3832,9 +3830,6 @@ static void insert_wq_barrier(struct pool_workqueue *pwq,
 		__set_bit(WORK_STRUCT_LINKED_BIT, bits);
 	}
 
-	pwq->nr_in_flight[pwq->work_color]++;
-	work_flags |= work_color_to_flags(pwq->work_color);
-
 	insert_work(pwq, &barr->work, head, work_flags);
 }
 
-- 
2.19.1.6.gb485710b


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ