mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kemi <kemi.wang@intel.com>
To: Jan Kara <jack@suse.cz>, Jens Axboe <axboe@fb.com>,
	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 v2] buffer: Avoid setting buffer bits that are already set
Date: Fri, 3 Nov 2017 10:29:13 +0800	[thread overview]
Message-ID: <f18ba82a-e715-a71c-4904-3adc9b8ea149@intel.com> (raw)
In-Reply-To: <1508807802-9691-1-git-send-email-kemi.wang@intel.com>



On 2017年10月24日 09:16, 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.
> 
> Signed-off-by: Andi Kleen <ak@linux.intel.com>
> Signed-off-by: Kemi Wang <kemi.wang@intel.com>
> Tested-by: Kemi Wang <kemi.wang@intel.com>
> Reviewed-by: Jens Axboe <axboe@kernel.dk>
> ---

Seems that this patch is still not merged. Anything wrong with that? thanks

>  include/linux/buffer_head.h | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
> index c8dae55..211d8f5 100644
> --- a/include/linux/buffer_head.h
> +++ b/include/linux/buffer_head.h
> @@ -80,11 +80,14 @@ struct buffer_head {
>  /*
>   * macro tricks to expand the set_buffer_foo(), clear_buffer_foo()
>   * and buffer_foo() functions.
> + * To avoid reset buffer flags that are already set, because that causes
> + * a costly cache line transition, check the flag first.
>   */
>  #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)	\
>  {									\
> 

  reply	other threads:[~2017-11-03  2:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-24  1:16 Kemi Wang
2017-11-03  2:29 ` kemi [this message]
2018-02-02  8:07   ` kemi
2018-02-02 14: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=f18ba82a-e715-a71c-4904-3adc9b8ea149@intel.com \
    --to=kemi.wang@intel.com \
    --cc=aaron.lu@intel.com \
    --cc=agruenba@redhat.com \
    --cc=andi.kleen@intel.com \
    --cc=axboe@fb.com \
    --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®