diff mbox series

[1/2] btrfs: set default discard iops_limit to 1000

Message ID 45f813c5fabdb32df67ba661c396c592b863ff25.1680711209.git.boris@bur.io (mailing list archive)
State New, archived
Headers show
Series btrfs: adjust async discard tuning | expand

Commit Message

Boris Burkov April 5, 2023, 4:20 p.m. UTC
Previously, the default was a relatively conservative 10. This results
in a 100ms delay, so with ~300 discards in a commit, it takes the full
30s till the next commit to finish the discards. On a workstation, this
results in the disk never going idle, wasting power/battery, etc.

Set the default to 1000, which results in using the smallest possible
delay, currently, which is 1ms. This has shown to not pathologically
keep the disk busy by the original reporter.

Link: https://lore.kernel.org/linux-btrfs/ZCxKc5ZzP3Np71IC@infradead.org/T/#m6ebdeb475809ed7714b21b8143103fb7e5a966da
Signed-off-by: Boris Burkov <boris@bur.io>
---
 fs/btrfs/discard.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Roman Mamedov April 5, 2023, 5:34 p.m. UTC | #1
On Wed,  5 Apr 2023 09:20:32 -0700
Boris Burkov <boris@bur.io> wrote:

> Previously, the default was a relatively conservative 10. This results
> in a 100ms delay, so with ~300 discards in a commit, it takes the full
> 30s till the next commit to finish the discards. On a workstation, this
> results in the disk never going idle, wasting power/battery, etc.
> 
> Set the default to 1000, which results in using the smallest possible
> delay, currently, which is 1ms. This has shown to not pathologically
> keep the disk busy by the original reporter.
> 
> Link: https://lore.kernel.org/linux-btrfs/ZCxKc5ZzP3Np71IC@infradead.org/T/#m6ebdeb475809ed7714b21b8143103fb7e5a966da
> Signed-off-by: Boris Burkov <boris@bur.io>
> ---
>  fs/btrfs/discard.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/discard.c b/fs/btrfs/discard.c
> index 317aeff6c1da..aef789bcff8f 100644
> --- a/fs/btrfs/discard.c
> +++ b/fs/btrfs/discard.c
> @@ -60,7 +60,7 @@
>  #define BTRFS_DISCARD_TARGET_MSEC	(6 * 60 * 60UL * MSEC_PER_SEC)
>  #define BTRFS_DISCARD_MIN_DELAY_MSEC	(1UL)
>  #define BTRFS_DISCARD_MAX_DELAY_MSEC	(1000UL)
> -#define BTRFS_DISCARD_MAX_IOPS		(10U)
> +#define BTRFS_DISCARD_MAX_IOPS		(10000U)

But the patch sets 10000?

>  
>  /* Monotonically decreasing minimum length filters after index 0 */
>  static int discard_minlen[BTRFS_NR_DISCARD_LISTS] = {
Boris Burkov April 5, 2023, 6:46 p.m. UTC | #2
On Wed, Apr 05, 2023 at 10:34:49PM +0500, Roman Mamedov wrote:
> On Wed,  5 Apr 2023 09:20:32 -0700
> Boris Burkov <boris@bur.io> wrote:
> 
> > Previously, the default was a relatively conservative 10. This results
> > in a 100ms delay, so with ~300 discards in a commit, it takes the full
> > 30s till the next commit to finish the discards. On a workstation, this
> > results in the disk never going idle, wasting power/battery, etc.
> > 
> > Set the default to 1000, which results in using the smallest possible
> > delay, currently, which is 1ms. This has shown to not pathologically
> > keep the disk busy by the original reporter.
> > 
> > Link: https://lore.kernel.org/linux-btrfs/ZCxKc5ZzP3Np71IC@infradead.org/T/#m6ebdeb475809ed7714b21b8143103fb7e5a966da
> > Signed-off-by: Boris Burkov <boris@bur.io>
> > ---
> >  fs/btrfs/discard.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/fs/btrfs/discard.c b/fs/btrfs/discard.c
> > index 317aeff6c1da..aef789bcff8f 100644
> > --- a/fs/btrfs/discard.c
> > +++ b/fs/btrfs/discard.c
> > @@ -60,7 +60,7 @@
> >  #define BTRFS_DISCARD_TARGET_MSEC	(6 * 60 * 60UL * MSEC_PER_SEC)
> >  #define BTRFS_DISCARD_MIN_DELAY_MSEC	(1UL)
> >  #define BTRFS_DISCARD_MAX_DELAY_MSEC	(1000UL)
> > -#define BTRFS_DISCARD_MAX_IOPS		(10U)
> > +#define BTRFS_DISCARD_MAX_IOPS		(10000U)
> 
> But the patch sets 10000?

Oops. Thanks!

... Just testing the clamping? I did run the code and observe 100ms
delays between workfn runs, for what it's worth, so it "should be fine"
but I'll resend setting it to 1k properly.

> 
> >  
> >  /* Monotonically decreasing minimum length filters after index 0 */
> >  static int discard_minlen[BTRFS_NR_DISCARD_LISTS] = {
> 
> 
> -- 
> With respect,
> Roman
diff mbox series

Patch

diff --git a/fs/btrfs/discard.c b/fs/btrfs/discard.c
index 317aeff6c1da..aef789bcff8f 100644
--- a/fs/btrfs/discard.c
+++ b/fs/btrfs/discard.c
@@ -60,7 +60,7 @@ 
 #define BTRFS_DISCARD_TARGET_MSEC	(6 * 60 * 60UL * MSEC_PER_SEC)
 #define BTRFS_DISCARD_MIN_DELAY_MSEC	(1UL)
 #define BTRFS_DISCARD_MAX_DELAY_MSEC	(1000UL)
-#define BTRFS_DISCARD_MAX_IOPS		(10U)
+#define BTRFS_DISCARD_MAX_IOPS		(10000U)
 
 /* Monotonically decreasing minimum length filters after index 0 */
 static int discard_minlen[BTRFS_NR_DISCARD_LISTS] = {