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]
Date:   Mon, 23 Oct 2017 11:19:47 -0500
From:   Jens Axboe <axboe@...nel.dk>
To:     Kemi Wang <kemi.wang@...el.com>, Jan Kara <jack@...e.cz>,
        Darrick J Wong <darrick.wong@...cle.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: Re: [PATCH] buffer: Avoid setting buffer bits that are already set

On 10/23/2017 10:27 AM, Kemi Wang wrote:
> 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.

We discussed this recently, in reference to this commit:

commit 7fcbbaf18392f0b17c95e2f033c8ccf87eecde1d
Author: Jens Axboe <axboe@...com>
Date:   Thu May 22 11:54:16 2014 -0700

    mm/filemap.c: avoid always dirtying mapping->flags on O_DIRECT

which made a massive difference, as the changelog details.

blk-mq uses this extensively as well, where possible. The problem is
that it always has to be explained, hence the recent discussion was
around perhaps adding

set_bit_if_not_set()
clear_bit_if_set()

or similar functions, to document in a single location why this matters.
Additionally, some archs may be able to implement that in an efficient
manner.

You can add my reviewed-by to the below, I'll see if I can find some
time to implement the above in a nice way. In the mean time, you may
want to consider adding a comment to the function explaining why you
have done it that way.

-- 
Jens Axboe

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ