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:   Wed, 12 Sep 2018 21:58:29 +0800
From:   liusong@....com
To:     tj@...nel.org, jiangshanlai@...il.com
Cc:     liu.song11@....com.cn, linux-kernel@...r.kernel.org
Subject: [PATCH] workqueue: combine judgments in the loop of maybe_create_worker

From: Liu Song <liu.song11@....com.cn>

Although the 'need_to_create_worker' has been determined to be
true before entering the function. However, adjusting the order
of judgment can combine two judgments in the loop. Also improve
the matching between logical operations and function naming.

Signed-off-by: Liu Song <liu.song11@....com.cn>
---
 kernel/workqueue.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 78b192071ef7..3c7c90d70dcf 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -1969,13 +1969,10 @@ __acquires(&pool->lock)
 	mod_timer(&pool->mayday_timer, jiffies + MAYDAY_INITIAL_TIMEOUT);
 
 	while (true) {
-		if (create_worker(pool) || !need_to_create_worker(pool))
+		if (!need_to_create_worker(pool) || create_worker(pool))
 			break;
 
 		schedule_timeout_interruptible(CREATE_COOLDOWN);
-
-		if (!need_to_create_worker(pool))
-			break;
 	}
 
 	del_timer_sync(&pool->mayday_timer);
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ