linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: David Howells <dhowells@redhat.com>
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] smp_rmb_cond
Date: Mon, 19 Apr 2021 23:17:24 +0100	[thread overview]
Message-ID: <20210419221724.GG2531743@casper.infradead.org> (raw)
In-Reply-To: <1929623.1618863640@warthog.procyon.org.uk>

On Mon, Apr 19, 2021 at 09:20:40PM +0100, David Howells wrote:
> Matthew Wilcox <willy@infradead.org> wrote:
> 
> > i see worse inlining decisions from gcc with this.  maybe you see
> > an improvement that would justify it?
> > 
> > [ref: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99998]
> 
> Perhaps attach the patch to the bz, see if the compiler guys can recommend
> anything?

your test case loses the bogus branch

0000000000000000 <PageUptodate>:
   0:   48 8b 47 08             mov    0x8(%rdi),%rax
   4:   a8 01                   test   $0x1,%al
   6:   74 04                   je     c <PageUptodate+0xc>
   8:   48 8d 78 ff             lea    -0x1(%rax),%rdi
   c:   8b 07                   mov    (%rdi),%eax
   e:   48 c1 e8 02             shr    $0x2,%rax
  12:   24 01                   and    $0x1,%al
  14:   74 00                   je     16 <PageUptodate+0x16>
  16:   c3                      retq   

0000000000000017 <Page2Uptodate>:
  17:   48 8b 47 08             mov    0x8(%rdi),%rax
  1b:   a8 01                   test   $0x1,%al
  1d:   74 04                   je     23 <Page2Uptodate+0xc>
  1f:   48 8d 78 ff             lea    -0x1(%rax),%rdi
  23:   8b 07                   mov    (%rdi),%eax
  25:   48 c1 e8 02             shr    $0x2,%rax
  29:   83 e0 01                and    $0x1,%eax
  2c:   c3                      retq   

but that means that gcc then does more inlining to functions that
call PageUptodate:

$ ./scripts/bloat-o-meter filemap-before.o filemap-after.o 
add/remove: 0/0 grow/shrink: 3/4 up/down: 179/-91 (88)
Function                                     old     new   delta
mapping_seek_hole_data                      1203    1347    +144
__lock_page_killable                         394     426     +32
next_uptodate_page                           603     606      +3
wait_on_page_bit_common                      582     576      -6
filemap_get_pages                           1530    1512     -18
do_read_cache_page                          1031    1012     -19
filemap_read_page                            261     213     -48
Total: Before=24603, After=24691, chg +0.36%

but maybe you have a metric that shows this winning at scale instead
of in a micro?

      reply	other threads:[~2021-04-19 22:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-19 20:12 [PATCH] smp_rmb_cond Matthew Wilcox
2021-04-19 20:20 ` David Howells
2021-04-19 22:17   ` Matthew Wilcox [this message]

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=20210419221724.GG2531743@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=dhowells@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).