From: David Sterba <dsterba@suse.cz>
To: Christoph Hellwig <hch@infradead.org>
Cc: David Sterba <dsterba@suse.com>,
linux-btrfs@vger.kernel.org,
"Gustavo A . R . Silva" <gustavoars@kernel.org>
Subject: Re: [PATCH] btrfs: add special case to setget helpers for 64k pages
Date: Fri, 2 Jul 2021 13:06:30 +0200 [thread overview]
Message-ID: <20210702110630.GE2610@twin.jikos.cz> (raw)
In-Reply-To: <YN67+nvpQBfiLXzh@infradead.org>
On Fri, Jul 02, 2021 at 08:10:50AM +0100, Christoph Hellwig wrote:
> > + if (INLINE_EXTENT_BUFFER_PAGES == 1) { \
> > return get_unaligned_le##bits(token->kaddr + oip); \
> > + } else { \
>
> No need for an else after the return and thus no need for all the
> reformatting.
That leads to worse code, compiler does not eliminate the block that
would otherwise be in the else block. Measured on x86_64 with
instrumented code to force INLINE_EXTENT_BUFFER_PAGES = 1 this adds
+1100 bytes of code and has impact on stack consumption.
That the code that is in two branches that do not share any code is
maybe not pretty but the compiler did what I expected. The set/get
helpers get called a lot and are performance sensitive.
This patch pre (original version), post (with dropped else):
1156210 19305 14912 1190427 122a1b pre/btrfs.ko
1157386 19305 14912 1191603 122eb3 post/btrfs.ko
DELTA: +1176
And effect on function stacks:
btrfs_set_token_32 +8 (48 -> 56)
btrfs_set_token_64 +16 (48 -> 64)
btrfs_set_32 +32 (32 -> 64)
btrfs_set_16 +32 (32 -> 64)
btrfs_set_token_16 +8 (48 -> 56)
btrfs_set_64 +40 (32 -> 72)
btrfs_set_token_8 -8 (48 -> 40)
next prev parent reply other threads:[~2021-07-02 11:09 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-01 16:00 [PATCH] btrfs: add special case to setget helpers for 64k pages David Sterba
2021-07-01 21:57 ` Gustavo A. R. Silva
2021-07-01 23:59 ` Qu Wenruo
2021-07-02 0:09 ` Gustavo A. R. Silva
2021-07-02 0:21 ` Qu Wenruo
2021-07-02 0:39 ` Gustavo A. R. Silva
2021-07-02 0:39 ` Qu Wenruo
2021-07-02 1:09 ` Gustavo A. R. Silva
2021-07-02 10:22 ` David Sterba
2021-07-02 7:10 ` Christoph Hellwig
2021-07-02 11:06 ` David Sterba [this message]
2021-07-05 8:33 ` Christoph Hellwig
2021-07-08 14:34 ` David Sterba
2021-07-14 23:37 ` Gustavo A. R. Silva
2021-07-28 15:32 ` David Sterba
2021-07-28 16:00 ` David Sterba
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=20210702110630.GE2610@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=dsterba@suse.com \
--cc=gustavoars@kernel.org \
--cc=hch@infradead.org \
--cc=linux-btrfs@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.