linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: 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: Tue, 2 Jan 2024 22:18:14 +0000	[thread overview]
Message-ID: <ZZSLpjttJec+t1CQ@casper.infradead.org> (raw)
In-Reply-To: <20240102162620.GA15380@twin.jikos.cz>

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 ...

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.


  parent reply	other threads:[~2024-01-02 22:18 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 [this message]
2024-01-02 22:32     ` Qu Wenruo

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=ZZSLpjttJec+t1CQ@casper.infradead.org \
    --to=willy@infradead.org \
    --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=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