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, 24 Feb 2010 21:20:35 +0100
From:	Oleg Nesterov <oleg@...hat.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	Dmitry Torokhov <dmitry.torokhov@...il.com>,
	Samu Onkalo <samu.p.onkalo@...ia.com>,
	Tejun Heo <tj@...nel.org>, linux-kernel@...r.kernel.org
Subject: [PATCH 2/3] workqueues: microoptimize set_wq_data()

The comment correctly states that the _PENDING bit must be set and
we even have the BUG_ON() check. But this means there is no need to
set WORK_STRUCT_PENDING explicitely and load work_data_bits() twice,
we can rely on WORK_STRUCT_FLAG_MASK which contains _PENDING.

Shaves 32 bytes from workqueue.o.

Signed-off-by: Oleg Nesterov <oleg@...hat.com>
---

 kernel/workqueue.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

--- wq/kernel/workqueue.c~2_CLEANUP_SET_DATA	2010-02-24 20:55:53.000000000 +0100
+++ wq/kernel/workqueue.c	2010-02-24 20:58:37.000000000 +0100
@@ -220,12 +220,9 @@ struct cpu_workqueue_struct *wq_per_cpu(
 static inline void set_wq_data(struct work_struct *work,
 				struct cpu_workqueue_struct *cwq)
 {
-	unsigned long new;
-
-	BUG_ON(!work_pending(work));
-
-	new = (unsigned long) cwq | (1UL << WORK_STRUCT_PENDING);
+	unsigned long new = (unsigned long)cwq;
 	new |= WORK_STRUCT_FLAG_MASK & *work_data_bits(work);
+	BUG_ON(!(new & (1UL << WORK_STRUCT_PENDING)));
 	atomic_long_set(&work->data, new);
 }
 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ