All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: Josef Bacik <josef@toxicpanda.com>,
	linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH v2 09/11] btrfs: implement space clamping for preemptive flushing
Date: Fri, 9 Oct 2020 15:22:45 +0300	[thread overview]
Message-ID: <f5156e78-08c5-caae-435b-3e182292460b@suse.com> (raw)
In-Reply-To: <501bfeaa3dc6f4c59dd6062f6108bab974316b85.1602189832.git.josef@toxicpanda.com>



On 8.10.20 г. 23:48 ч., Josef Bacik wrote:
> Starting preemptive flushing at 50% of available free space is a good
> start, but some workloads are particularly abusive and can quickly
> overwhelm the preemptive flushing code and drive us into using tickets.
> 
> Handle this by clamping down on our threshold for starting and
> continuing to run preemptive flushing.  This is particularly important
> for our overcommit case, as we can really drive the file system into
> overages and then it's more difficult to pull it back as we start to
> actually fill up the file system.
> 
> The clamping is essentially 2^CLAMP, but we start at 1 so whatever we
> calculate for overcommit is the baseline.
> 

<snip>

> +static inline void maybe_clamp_preempt(struct btrfs_fs_info *fs_info,
> +				       struct btrfs_space_info *space_info)
> +{
> +	u64 ordered, delalloc;
> +
> +	ordered = percpu_counter_sum_positive(&fs_info->ordered_bytes);
> +	delalloc = percpu_counter_sum_positive(&fs_info->delalloc_bytes);

nit: This can easily be rewritten to :

 u64 ordered = percpu_counter_sum_positive(&fs_info->ordered_bytes);
 u64 delalloc =  percpu_counter_sum_positive(&fs_info->delalloc_bytes);

as it doesn't cross the 80 chars boundary, no need for the extra 2 lines :)

> +
> +	/*
> +	 * If we're heavy on ordered operations then clamping won't help us.  We
> +	 * need to clamp specifically to keep up with dirty'ing buffered
> +	 * writers, because there's not a 1:1 correlation of writing delalloc
> +	 * and freeing space, like there is with flushing delayed refs or
> +	 * delayed nodes.  If we're already more ordered than delalloc then
> +	 * we're keeping up, otherwise we aren't and should probably clamp.
> +	 */
> +	if (ordered < delalloc)
> +		space_info->clamp = min(space_info->clamp + 1, 8);
> +}

<snip>


  reply	other threads:[~2020-10-09 12:22 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-08 20:48 [PATCH v2 00/11] Improve preemptive ENOSPC flushing Josef Bacik
2020-10-08 20:48 ` [PATCH v2 01/11] btrfs: add a trace point for reserve tickets Josef Bacik
2020-10-09  7:20   ` Nikolay Borisov
2020-10-08 20:48 ` [PATCH v2 02/11] btrfs: track ordered bytes instead of just dio ordered bytes Josef Bacik
2020-10-09  7:25   ` Nikolay Borisov
2020-10-08 20:48 ` [PATCH v2 03/11] btrfs: introduce a FORCE_COMMIT_TRANS flush operation Josef Bacik
2020-10-08 20:48 ` [PATCH v2 04/11] btrfs: improve preemptive background space flushing Josef Bacik
2020-10-08 20:48 ` [PATCH v2 05/11] btrfs: rename need_do_async_reclaim Josef Bacik
2020-10-08 20:48 ` [PATCH v2 06/11] btrfs: check reclaim_size in need_preemptive_reclaim Josef Bacik
2020-10-08 20:48 ` [PATCH v2 07/11] btrfs: rework btrfs_calc_reclaim_metadata_size Josef Bacik
2020-10-09  9:53   ` Nikolay Borisov
2020-10-08 20:48 ` [PATCH v2 08/11] btrfs: simplify the logic in need_preemptive_flushing Josef Bacik
2020-10-08 20:48 ` [PATCH v2 09/11] btrfs: implement space clamping for preemptive flushing Josef Bacik
2020-10-09 12:22   ` Nikolay Borisov [this message]
2020-10-08 20:48 ` [PATCH v2 10/11] btrfs: adjust the flush trace point to include the source Josef Bacik
2020-10-08 20:48 ` [PATCH v2 11/11] btrfs: add a trace class for dumping the current ENOSPC state Josef Bacik
2020-10-09  9:50   ` Nikolay Borisov
2020-10-09 10:39 ` [PATCH v2 00/11] Improve preemptive ENOSPC flushing Nikolay Borisov

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=f5156e78-08c5-caae-435b-3e182292460b@suse.com \
    --to=nborisov@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=kernel-team@fb.com \
    --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.