public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: Filipe Manana <fdmanana@kernel.org>
Cc: kernel test robot <oliver.sang@intel.com>,
	Filipe Manana <fdmanana@suse.com>,
	oe-lkp@lists.linux.dev, lkp@intel.com,
	David Sterba <dsterba@suse.com>,
	linux-btrfs@vger.kernel.org, ying.huang@intel.com,
	feng.tang@intel.com, fengwei.yin@intel.com
Subject: Re: [kdave-btrfs-devel:dev/guilherme/temp-fsid-v4] [btrfs] 6c9131ed0d: stress-ng.sync-file.ops_per_sec -44.2% regression
Date: Tue, 26 Sep 2023 15:08:24 -0400	[thread overview]
Message-ID: <20230926190824.GA407285@perftesting> (raw)
In-Reply-To: <ZRMqjzDP/G+MKL5R@debian0.Home>

On Tue, Sep 26, 2023 at 08:01:35PM +0100, Filipe Manana wrote:
> On Tue, Sep 26, 2023 at 03:34:59PM +0800, kernel test robot wrote:
> > 
> > 
> > Hello,
> > 
> > kernel test robot noticed a -44.2% regression of stress-ng.sync-file.ops_per_sec on:
> > 
> > 
> > commit: 6c9131ed0d644324adeeaccd2feeef8d04950b2d ("btrfs: always reserve space for delayed refs when starting transaction")
> > https://github.com/kdave/btrfs-devel.git dev/guilherme/temp-fsid-v4
> 
> David, can you remove this patch from misc-next/for-next in the meanwhile?
> 
> Starting to reserve space in advance for delayed refs is causing the slowdown,
> and I can reproduce it with the stress-ng test reported below.
> 
> By avoiding refilling the delayed block reserve I can recover about 60% of the
> lost performance, but that increases the chance in extreme scenarios of exhausting
> the global reserve and reaching a dead end -ENOSPC while committing transactions.
> It has happened rarely, both upstream and on SLE kernels.
> 
> At the moment I don't see how to keep both the upfront reservation of space for
> delayed refs and the refill of the delayed refs reserve without the performance
> impact on a test like that stress-ng test.

It's ok to eat a performance regression for correctness.  I think if you can
reduce the pain that's good, but going slower is better than not going at all.

Long term I have plans to make this better, stress-ng hilights the problem here
quite nicely.  The more pressure we have on the enospc machinery the more likely
we're going to do tickets and hit arbitrary waits.

What I want to do is take away the strict "we're over the limit, you now must
flush and wait" behavior and instead have something more akin to what MM does,
simply allow overcommit to occur, add the usage to a per-cpu counter everywhere
to avoid the spin lock contention, and then switch to the normal "ticket and
wait" system once we exceed certain thresholds.

Basically I want ENOSPC to not do anything until we're down to no chunk space
left and we're within 80% full in the available metadata block group.  This will
drastically improve performance, but is a larger project.

Until then trading performance for correctness is simply what we have to do.
Thanks,

Josef

  reply	other threads:[~2023-09-26 19:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-26  7:34 [kdave-btrfs-devel:dev/guilherme/temp-fsid-v4] [btrfs] 6c9131ed0d: stress-ng.sync-file.ops_per_sec -44.2% regression kernel test robot
2023-09-26 19:01 ` Filipe Manana
2023-09-26 19:08   ` Josef Bacik [this message]
2023-09-27 17:47     ` 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=20230926190824.GA407285@perftesting \
    --to=josef@toxicpanda.com \
    --cc=dsterba@suse.com \
    --cc=fdmanana@kernel.org \
    --cc=fdmanana@suse.com \
    --cc=feng.tang@intel.com \
    --cc=fengwei.yin@intel.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=oe-lkp@lists.linux.dev \
    --cc=oliver.sang@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