mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kemi <kemi.wang@intel.com>
To: Jens Axboe <axboe@kernel.dk>, Jan Kara <jack@suse.cz>,
	Darrick J Wong <darrick.wong@oracle.com>,
	Eric Biggers <ebiggers@google.com>,
	Andreas Gruenbacher <agruenba@redhat.com>,
	Jeff Layton <jlayton@redhat.com>
Cc: Dave <dave.hansen@linux.intel.com>,
	Andi Kleen <andi.kleen@intel.com>,
	Tim Chen <tim.c.chen@intel.com>,
	Ying Huang <ying.huang@intel.com>, Aaron Lu <aaron.lu@intel.com>,
	Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] buffer: Avoid setting buffer bits that are already set
Date: Tue, 24 Oct 2017 08:52:22 +0800	[thread overview]
Message-ID: <f475ae05-733d-b0a2-cadc-a5913f521153@intel.com> (raw)
In-Reply-To: <e2953a84-31d1-fdd2-faf8-62967a9f29c6@kernel.dk>



On 2017年10月24日 00:19, Jens Axboe wrote:
> 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@fb.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, 

Thanks.

I'll see if I can find some
> time to implement the above in a nice way.

Agree. Maybe something like test_and_set_bit() would be more suitable.

 In the mean time, you may
> want to consider adding a comment to the function explaining why you
> have done it that way.
> 

Sure.

  reply	other threads:[~2017-10-24  0:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-23 15:27 Kemi Wang
2017-10-23 16:19 ` Jens Axboe
2017-10-24  0:52   ` kemi [this message]
2017-10-24  1:21     ` Andi Kleen
2017-10-24  1:25       ` kemi
2017-10-24 13:50         ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f475ae05-733d-b0a2-cadc-a5913f521153@intel.com \
    --to=kemi.wang@intel.com \
    --cc=aaron.lu@intel.com \
    --cc=agruenba@redhat.com \
    --cc=andi.kleen@intel.com \
    --cc=axboe@kernel.dk \
    --cc=darrick.wong@oracle.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=ebiggers@google.com \
    --cc=jack@suse.cz \
    --cc=jlayton@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tim.c.chen@intel.com \
    --cc=ying.huang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®