From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Matthew Wilcox <willy@infradead.org>, David Sterba <dsterba@suse.cz>
Cc: kernel test robot <oliver.sang@intel.com>,
Qu Wenruo <wqu@suse.com>,
oe-lkp@lists.linux.dev, lkp@intel.com,
Linux Memory Management List <linux-mm@kvack.org>,
David Sterba <dsterba@suse.com>,
linux-btrfs@vger.kernel.org, ying.huang@intel.com,
feng.tang@intel.com, fengwei.yin@intel.com
Subject: Re: [linux-next:master] [btrfs] 8d99361835: stress-ng.link.ops_per_sec -18.0% regression
Date: Wed, 3 Jan 2024 09:02:42 +1030 [thread overview]
Message-ID: <ee1896b4-c79d-409d-8388-6cc53d171740@gmx.com> (raw)
In-Reply-To: <ZZSLpjttJec+t1CQ@casper.infradead.org>
On 2024/1/3 08:48, Matthew Wilcox wrote:
> On Tue, Jan 02, 2024 at 05:26:20PM +0100, David Sterba wrote:
>> On Fri, Dec 22, 2023 at 05:59:34PM +0800, kernel test robot wrote:
>>>
>>>
>>> Hello,
>>>
>>> kernel test robot noticed a -18.0% regression of stress-ng.link.ops_per_sec on:
>>>
>>>
>>> commit: 8d993618350c86da11cb408ba529c13e83d09527 ("btrfs: migrate get_eb_page_index() and get_eb_offset_in_page() to folios")
>>> https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git master
>>
>> Unfortunatelly the conversion to folios adds a lot of assembly code and
>> we can't rely on constants like PAGE_SIZE anymore. The calculations in
>> extent buffer members are therefore slower, 18% is a lot but within my
>> expected range for metadta-only operations.
>>
>> This could be improved by caching some values, like folio_size, so it's
>> a dereference and not a calculation of "PAGE_SIZE << folio_order" with
>> conditionals around.
>
> You're in the unfortunate position of paying all the costs of a variable
> folio size while not getting the benefit of variable folio sizes ...
No worry, IIRC the -next branch does NOT include the patch to enable
larger folios, just to shake out bugs during the conversion.
We're getting higher improvement already in previous -next branches
which included something reflecting larger folios (not exactly the same
behavior, but using vm_map).
>
> There's no space in struct folio to cache folio_size(). It's an
> loff_t, so potentially huge. Also there are people who have designs
> on the remaining space in struct folio for a variety of purposes.
> Would it be better to be PAGE_SIZE * folio_nr_pages(), which is cached?
> That's at least dereference, then shift-variable-by-constant, rather
> than dereference, shift-constant-by-variable.
>
The cache would be in btrfs' specific structure, extent_buffer, so no
affect on MM layer at all.
My plan is to cache a u8 for shift (which can be fitted into some hole),
and u32 for the folio size (which is only 1.5% increase in the size of
extent_buffer).
Thanks,
Qu
prev parent reply other threads:[~2024-01-02 22:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-22 9:59 kernel test robot
2024-01-02 16:26 ` David Sterba
2024-01-02 21:02 ` Qu Wenruo
2024-01-02 22:18 ` Matthew Wilcox
2024-01-02 22:32 ` Qu Wenruo [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=ee1896b4-c79d-409d-8388-6cc53d171740@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=dsterba@suse.com \
--cc=dsterba@suse.cz \
--cc=feng.tang@intel.com \
--cc=fengwei.yin@intel.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
--cc=oe-lkp@lists.linux.dev \
--cc=oliver.sang@intel.com \
--cc=willy@infradead.org \
--cc=wqu@suse.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