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]
Message-Id: <1508772444-27879-1-git-send-email-kemi.wang@intel.com>
Date:   Mon, 23 Oct 2017 23:27:24 +0800
From:   Kemi Wang <kemi.wang@...el.com>
To:     Jan Kara <jack@...e.cz>, Jens Axboe <axboe@...com>,
        Darrick J Wong <darrick.wong@...cle.com>,
        Kemi Wang <kemi.wang@...el.com>,
        Eric Biggers <ebiggers@...gle.com>,
        Andreas Gruenbacher <agruenba@...hat.com>,
        Jeff Layton <jlayton@...hat.com>
Cc:     Dave <dave.hansen@...ux.intel.com>,
        Andi Kleen <andi.kleen@...el.com>,
        Tim Chen <tim.c.chen@...el.com>,
        Ying Huang <ying.huang@...el.com>,
        Aaron Lu <aaron.lu@...el.com>,
        Linux Kernel <linux-kernel@...r.kernel.org>
Subject: [PATCH] buffer: Avoid setting buffer bits that are already set

It's expensive to set buffer flags that are already set, because that
causes a costly cache line transition.

A common case is setting the "verified" flag during ext4 writes.
This patch checks for the flag being set first.

With the AIM7/creat-clo benchmark testing on a 48G ramdisk based-on ext4
file system, we see 3.3%(15431->15936) improvement of aim7.jobs-per-min on
a 2-sockets broadwell platform.

What the benchmark does is: it forks 3000 processes, and each  process do
the following:
a) open a new file
b) close the file
c) delete the file
until loop=100*1000 times.

The original patch is contributed by Andi Kleen.

Signed-off-by: Andi Kleen <ak@...ux.intel.com>
Signed-off-by: Kemi Wang <kemi.wang@...el.com>
Tested-by: Kemi Wang <kemi.wang@...el.com>
---
 include/linux/buffer_head.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index c8dae55..e1799f7 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -84,7 +84,8 @@ struct buffer_head {
 #define BUFFER_FNS(bit, name)						\
 static __always_inline void set_buffer_##name(struct buffer_head *bh)	\
 {									\
-	set_bit(BH_##bit, &(bh)->b_state);				\
+	if (!test_bit(BH_##bit, &(bh)->b_state))			\
+		set_bit(BH_##bit, &(bh)->b_state);              \
 }									\
 static __always_inline void clear_buffer_##name(struct buffer_head *bh)	\
 {									\
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ