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-next>] [day] [month] [year] [list]
Date:   Mon, 27 Jul 2020 20:29:29 +0800
From:   linmiaohe <linmiaohe@...wei.com>
To:     <tj@...nel.org>, <jiangshanlai@...il.com>
CC:     <linux-kernel@...r.kernel.org>, <linmiaohe@...wei.com>
Subject: [PATCH] workqueue: Use wake_up_worker() to wake up first idle worker

From: Miaohe Lin <linmiaohe@...wei.com>

Use wrapper function wake_up_worker() to wake up first idle worker.

Signed-off-by: Miaohe Lin <linmiaohe@...wei.com>
---
 kernel/workqueue.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index c41c3c17b86a..5302f227f38f 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -864,7 +864,7 @@ void wq_worker_running(struct task_struct *task)
  */
 void wq_worker_sleeping(struct task_struct *task)
 {
-	struct worker *next, *worker = kthread_data(task);
+	struct worker *worker = kthread_data(task);
 	struct worker_pool *pool;
 
 	/*
@@ -896,11 +896,9 @@ void wq_worker_sleeping(struct task_struct *task)
 	 * lock is safe.
 	 */
 	if (atomic_dec_and_test(&pool->nr_running) &&
-	    !list_empty(&pool->worklist)) {
-		next = first_idle_worker(pool);
-		if (next)
-			wake_up_process(next->task);
-	}
+	    !list_empty(&pool->worklist))
+		wake_up_worker(pool);
+
 	raw_spin_unlock_irq(&pool->lock);
 }
 
-- 
2.19.1

Powered by blists - more mailing lists