All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amy Parker <enbyamy@gmail.com>
To: Pavel Begunkov <asml.silence@gmail.com>
Cc: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>,
	Btrfs BTRFS <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH 1/4] btrfs: discard: speed up discard up to iops_limit
Date: Wed, 4 Nov 2020 07:29:03 -0800	[thread overview]
Message-ID: <CAE1WUT5+3xLHe54Mk0wEmp1GtbRhkMkdSi=QPERZegphk=ecLw@mail.gmail.com> (raw)
In-Reply-To: <2a3d84dfc9384eed8659963d1dafedabb3f17c75.1604444952.git.asml.silence@gmail.com>

On Wed, Nov 4, 2020 at 1:50 AM Pavel Begunkov <asml.silence@gmail.com> wrote:
>
> Instead of using iops_limit only for cutting off extremes, calculate the
> discard delay directly from it, so it closely follows iops_limit and
> doesn't under-discarding even though quotas are not saturated.

This sounds like it potentially be a great performance boost, do you
have any performance metrics regarding this patch?

>
> Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
> ---
>  fs/btrfs/discard.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/fs/btrfs/discard.c b/fs/btrfs/discard.c
> index 741c7e19c32f..76796a90e88d 100644
> --- a/fs/btrfs/discard.c
> +++ b/fs/btrfs/discard.c
> @@ -519,7 +519,6 @@ void btrfs_discard_calc_delay(struct btrfs_discard_ctl *discard_ctl)
>         s64 discardable_bytes;
>         u32 iops_limit;
>         unsigned long delay;
> -       unsigned long lower_limit = BTRFS_DISCARD_MIN_DELAY_MSEC;
>
>         discardable_extents = atomic_read(&discard_ctl->discardable_extents);
>         if (!discardable_extents)
> @@ -550,11 +549,12 @@ void btrfs_discard_calc_delay(struct btrfs_discard_ctl *discard_ctl)
>
>         iops_limit = READ_ONCE(discard_ctl->iops_limit);
>         if (iops_limit)
> -               lower_limit = max_t(unsigned long, lower_limit,
> -                                   MSEC_PER_SEC / iops_limit);
> +               delay = MSEC_PER_SEC / iops_limit;
> +       else
> +               delay = BTRFS_DISCARD_TARGET_MSEC / discardable_extents;

Looks good to me. I wonder why there wasn't handling of if iops_limit
was unfindable
before?

>
> -       delay = BTRFS_DISCARD_TARGET_MSEC / discardable_extents;
> -       delay = clamp(delay, lower_limit, BTRFS_DISCARD_MAX_DELAY_MSEC);
> +       delay = clamp(delay, BTRFS_DISCARD_MIN_DELAY_MSEC,
> +                     BTRFS_DISCARD_MAX_DELAY_MSEC);
>         discard_ctl->delay = msecs_to_jiffies(delay);
>
>         spin_unlock(&discard_ctl->lock);
> --
> 2.24.0
>

This patch looks all great to me.

Best regards,
Amy Parker
(they/them)

  reply	other threads:[~2020-11-04 15:29 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-04  9:45 [PATCH 0/4] fixes for btrfs async discards Pavel Begunkov
2020-11-04  9:45 ` [PATCH 1/4] btrfs: discard: speed up discard up to iops_limit Pavel Begunkov
2020-11-04 15:29   ` Amy Parker [this message]
2020-11-04 17:19     ` Pavel Begunkov
2020-11-04 17:33       ` Amy Parker
2020-11-04 17:47         ` Pavel Begunkov
2020-11-04 17:55           ` Amy Parker
2020-11-04 18:06             ` Pavel Begunkov
2020-11-04 18:14               ` Amy Parker
2020-11-04 20:52   ` Josef Bacik
2020-11-04  9:45 ` [PATCH 2/4] btrfs: discard: save discard delay as ns not jiffy Pavel Begunkov
2020-11-04 15:35   ` Amy Parker
2020-11-04 15:48     ` Pavel Begunkov
2020-11-04 16:46       ` Amy Parker
2020-11-04 20:54   ` Josef Bacik
2020-11-04  9:45 ` [PATCH 3/4] btrfs: don't miss discards after override-schedule Pavel Begunkov
2020-11-04 20:59   ` Josef Bacik
2020-11-04 21:23     ` Pavel Begunkov
2020-11-04  9:45 ` [PATCH 4/4] btrfs: discard: reschedule work after param update Pavel Begunkov
2020-11-04 21:00   ` Josef Bacik
2020-11-05 22:23 ` [PATCH 0/4] fixes for btrfs async discards David Sterba
2020-11-06 13:20   ` Pavel Begunkov
2020-11-06 13:56     ` David Sterba
2020-11-06 14:19     ` Chris Mason

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='CAE1WUT5+3xLHe54Mk0wEmp1GtbRhkMkdSi=QPERZegphk=ecLw@mail.gmail.com' \
    --to=enbyamy@gmail.com \
    --cc=asml.silence@gmail.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.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.