Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: Chris Murphy <lists@colorremedies.com>,
	Btrfs BTRFS <linux-btrfs@vger.kernel.org>
Subject: Re: fstrim is takes a long time on Btrfs and NVMe
Date: Sun, 22 Dec 2019 12:43:29 -0500	[thread overview]
Message-ID: <c246f5e9-c9b6-8323-9e2d-26f17051df6a@toxicpanda.com> (raw)
In-Reply-To: <CAJCQCtTQ-xkWtSzXd14hb1bmozg3U8H2pxQMO7PqEJjymCcCGA@mail.gmail.com>

On 12/21/19 1:24 AM, Chris Murphy wrote:
> Hi,
> 
> Recent kernels, I think since 5.1 or 5.2, but tested today on 5.3.18,
> 5.4.5, 5.5.0rc2, takes quite a long time for `fstrim /` to complete,
> just over 1 minute.
> 
> Filesystem      Size  Used Avail Use% Mounted on
> /dev/nvme0n1p7  178G   16G  161G   9% /
> 
> fstrim stops on this for pretty much the entire time:
> ioctl(3, FITRIM, {start=0, len=0xffffffffffffffff, minlen=0}) = 0
> 
> top shows the fstrim process itself isn't consuming much CPU, about
> 2-3%. Top five items in per top, not much more revealing.
> 
> Samples: 220K of event 'cycles', 4000 Hz, Event count (approx.):
> 3463316966 lost: 0/0 drop: 0/0
> Overhead  Shared Object                    Symbol
>     1.62%  [kernel]                         [k] find_next_zero_bit
>     1.59%  perf                             [.] 0x00000000002ae063
>     1.52%  [kernel]                         [k] psi_task_change
>     1.41%  [kernel]                         [k] update_blocked_averages
>     1.33%  [unknown]                        [.] 0000000000000000
> 
> On a different system, with older Samsung 840 SATA SSD, and a fresh
> Btrfs, I can't reproduce. It takes less than 1s. Not sure how to get
> more information.
> 
> 

You want to try Dennis's async discard stuff?  That should fix these problems 
for you, the patches are in Dave's tree.  Thanks,

Josef


  parent reply	other threads:[~2019-12-22 17:43 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-21  6:24 fstrim is takes a long time on Btrfs and NVMe Chris Murphy
2019-12-21  8:38 ` Andrea Gelmini
2019-12-21  9:27 ` Nikolay Borisov
2019-12-22  3:43   ` Chris Murphy
2019-12-22  3:59     ` Chris Murphy
2019-12-22 10:40 ` Nikolay Borisov
2019-12-22 17:43 ` Josef Bacik [this message]
2019-12-22 17:49   ` Nikolay Borisov
2019-12-22 18:00     ` Josef Bacik
2019-12-22 18:06       ` Nikolay Borisov
2019-12-22 19:08         ` Chris Murphy
2019-12-22 19:15         ` Roman Mamedov
2019-12-22 22:11           ` Chris Murphy
2019-12-22 22:29             ` Nikolay Borisov
2019-12-22 23:14               ` Chris Murphy
2019-12-22 23:23                 ` Chris Murphy
2019-12-22 18:50       ` Chris Murphy

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=c246f5e9-c9b6-8323-9e2d-26f17051df6a@toxicpanda.com \
    --to=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=lists@colorremedies.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