linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC] block, bfq: set default slice_idle to zero for non-rotational devices
@ 2018-11-01 17:43 Konstantin Khlebnikov
  2018-11-01 19:06 ` Holger Hoffstätte
  0 siblings, 1 reply; 3+ messages in thread
From: Konstantin Khlebnikov @ 2018-11-01 17:43 UTC (permalink / raw)
  To: linux-block, Jens Axboe, Paolo Valente, linux-kernel

With default 8ms idle slice BFQ is up to 10 times slower than CFQ
for massive random read workloads for common SATA SSD.

For now zero idle slice gives better out of box experience.
CFQ employs this since commit 41c0126b3f22 ("block: Make CFQ default
to IOPS mode on SSDs")

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
---
 Documentation/block/bfq-iosched.txt |   12 +++++++-----
 block/bfq-iosched.c                 |    8 ++++----
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/Documentation/block/bfq-iosched.txt b/Documentation/block/bfq-iosched.txt
index 8d8d8f06cab2..c4a0f8998ce6 100644
--- a/Documentation/block/bfq-iosched.txt
+++ b/Documentation/block/bfq-iosched.txt
@@ -307,11 +307,13 @@ slice_idle
 ----------
 
 This parameter specifies how long BFQ should idle for next I/O
-request, when certain sync BFQ queues become empty. By default
-slice_idle is a non-zero value. Idling has a double purpose: boosting
-throughput and making sure that the desired throughput distribution is
-respected (see the description of how BFQ works, and, if needed, the
-papers referred there).
+request, when certain sync BFQ queues become empty.
+
+By default slice_idle is a non-zero value for rotational devices.
+
+Idling has a double purpose: boosting throughput and making sure that
+the desired throughput distribution is respected (see the description
+of how BFQ works, and, if needed, the papers referred there).
 
 As for throughput, idling can be very helpful on highly seeky media
 like single spindle SATA/SAS disks where we can cut down on overall
diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
index 6075100f03a5..d19e70a26ff0 100644
--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -177,8 +177,8 @@ static const int bfq_back_max = 16 * 1024;
 /* Penalty of a backwards seek, in number of sectors. */
 static const int bfq_back_penalty = 2;
 
-/* Idling period duration, in ns. */
-static u64 bfq_slice_idle = NSEC_PER_SEC / 125;
+/* Idling period duration, in ns. Zero for non-rotational devices. */
+static u64 bfq_slice_idle[2] = { NSEC_PER_SEC / 125, 0 };
 
 /* Minimum number of assigned budgets for which stats are safe to compute. */
 static const int bfq_stats_min_budgets = 194;
@@ -3044,7 +3044,7 @@ static bool bfq_bfqq_is_slow(struct bfq_data *bfqd, struct bfq_queue *bfqq,
 			  */
 			*delta_ms = BFQ_MIN_TT / NSEC_PER_MSEC;
 		else /* charge at least one seek */
-			*delta_ms = bfq_slice_idle / NSEC_PER_MSEC;
+			*delta_ms = bfq_slice_idle[0] / NSEC_PER_MSEC;
 
 		return slow;
 	}
@@ -5431,7 +5431,7 @@ static int bfq_init_queue(struct request_queue *q, struct elevator_type *e)
 	bfqd->bfq_fifo_expire[1] = bfq_fifo_expire[1];
 	bfqd->bfq_back_max = bfq_back_max;
 	bfqd->bfq_back_penalty = bfq_back_penalty;
-	bfqd->bfq_slice_idle = bfq_slice_idle;
+	bfqd->bfq_slice_idle = bfq_slice_idle[blk_queue_nonrot(bfqd->queue)];
 	bfqd->bfq_timeout = bfq_timeout;
 
 	bfqd->bfq_requests_within_timer = 120;


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH RFC] block, bfq: set default slice_idle to zero for non-rotational devices
  2018-11-01 17:43 [PATCH RFC] block, bfq: set default slice_idle to zero for non-rotational devices Konstantin Khlebnikov
@ 2018-11-01 19:06 ` Holger Hoffstätte
  2018-11-02 18:18   ` Paolo Valente
  0 siblings, 1 reply; 3+ messages in thread
From: Holger Hoffstätte @ 2018-11-01 19:06 UTC (permalink / raw)
  To: Konstantin Khlebnikov, linux-block, Jens Axboe, Paolo Valente,
	linux-kernel

On 11/01/18 18:43, Konstantin Khlebnikov wrote:
> With default 8ms idle slice BFQ is up to 10 times slower than CFQ
> for massive random read workloads for common SATA SSD.
> 
> For now zero idle slice gives better out of box experience.
> CFQ employs this since commit 41c0126b3f22 ("block: Make CFQ default
> to IOPS mode on SSDs")

Well, that's interesting because 3 years ago I made the same suggestion
and was told that BFQ's heuristics automagically make it not idle when
rotational=0. Did you actually benchmark this? I just tried and don't
get a noticeable performance difference with slice_idle=0 compared to
deadline.

Discussion link:
https://groups.google.com/forum/#!msg/bfq-iosched/iRMw2n3kYLY/6l9cIm3TBgAJ

curious..

Holger

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH RFC] block, bfq: set default slice_idle to zero for non-rotational devices
  2018-11-01 19:06 ` Holger Hoffstätte
@ 2018-11-02 18:18   ` Paolo Valente
  0 siblings, 0 replies; 3+ messages in thread
From: Paolo Valente @ 2018-11-02 18:18 UTC (permalink / raw)
  To: Holger Hoffstätte
  Cc: Konstantin Khlebnikov, linux-block, Jens Axboe, linux-kernel



> Il giorno 1 nov 2018, alle ore 22:06, Holger Hoffstätte <holger@applied-asynchrony.com> ha scritto:
> 
> On 11/01/18 18:43, Konstantin Khlebnikov wrote:
>> With default 8ms idle slice BFQ is up to 10 times slower than CFQ
>> for massive random read workloads for common SATA SSD.
>> For now zero idle slice gives better out of box experience.
>> CFQ employs this since commit 41c0126b3f22 ("block: Make CFQ default
>> to IOPS mode on SSDs")
> 
> Well, that's interesting because 3 years ago I made the same suggestion
> and was told that BFQ's heuristics automagically make it not idle when
> rotational=0.

Yep, that automagic is probably 50% of the good of BFQ.

If one just sets slice_idle=0, then throughput is always maximum with
random I/O; but there is no control on I/O any longer.

At any rate, Konstantin, if you have some use case where BFQ fails,
I'll be very glad to analyze it, and hopefully improve BFQ.  Just one
request: use at least a 4.19.

Thanks,
Paolo

> Did you actually benchmark this? I just tried and don't
> get a noticeable performance difference with slice_idle=0 compared to
> deadline.
> 
> Discussion link:
> https://groups.google.com/forum/#!msg/bfq-iosched/iRMw2n3kYLY/6l9cIm3TBgAJ
> 
> curious..
> 
> Holger


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-11-02 18:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-01 17:43 [PATCH RFC] block, bfq: set default slice_idle to zero for non-rotational devices Konstantin Khlebnikov
2018-11-01 19:06 ` Holger Hoffstätte
2018-11-02 18:18   ` Paolo Valente

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).