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] [day] [month] [year] [list]
Message-ID: <dbf9670a-13c8-634b-b10b-7da19c7c50be@hisilicon.com>
Date:   Mon, 8 Feb 2021 14:12:10 +0800
From:   Shaokun Zhang <zhangshaokun@...ilicon.com>
To:     Andrew Morton <akpm@...ux-foundation.org>
CC:     <linux-fsdevel@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        Yang Guo <guoyang2@...wei.com>,
        Alexander Viro <viro@...iv.linux.org.uk>,
        Nick Piggin <npiggin@...e.de>
Subject: Re: [PATCH] fs/buffer.c: Add checking buffer head stat before clear

Hi Andrew,

在 2021/2/6 7:45, Andrew Morton 写道:
> On Wed, 3 Feb 2021 14:14:50 +0800 Shaokun Zhang <zhangshaokun@...ilicon.com> wrote:
> 
>> From: Yang Guo <guoyang2@...wei.com>
>>
>> clear_buffer_new() is used to clear buffer new stat. When PAGE_SIZE
>> is 64K, most buffer heads in the list are not needed to clear.
>> clear_buffer_new() has an enpensive atomic modification operation,
>> Let's add checking buffer head before clear it as __block_write_begin_int
>> does which is good for performance.
> 
> Did this produce any measurable improvement?

It has been tested on Huwei Kunpeng 920 which is ARM64 platform and test commond is below:
numactl --cpunodebind=0 --membind=0 fio -name=randwrite -numjobs=16 -filename=/mnt/test1
-rw=randwrite -ioengine=libaio -direct=0 -iodepth=64 -sync=0 -norandommap -group_reporting
-runtime=60 -time_based -bs=4k -size=5G

The test result before patch:
WRITE: bw=930MiB/s (976MB/s), 930MiB/s-930MiB/s (976MB/s-976MB/s), io=54.5GiB (58.5GB),
run=60001-60001msec

The test result after patch:
WRITE: bw=958MiB/s (1005MB/s), 958MiB/s-958MiB/s (1005MB/s-1005MB/s), io=56.1GiB (60.3GB),
run=60001-60001msec

> 
> Perhaps we should give clear_buffer_x() the same optimization as
> set_buffer_x()?
> 

Good catch,
but we check it more about it, if we do it the same as set_buffer_x(),
many more codes will be fixed, such as ext4_wait_block_bitmap
it has done sanity check using buffer_new and clear_buffer_new
will check it again.

Thanks,
Shaokun

> 
> static __always_inline void set_buffer_##name(struct buffer_head *bh)	\
> {									\
> 	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)	\
> {									\
> 	clear_bit(BH_##bit, &(bh)->b_state);				\
> }									\
> 
> 
> .
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ