Skip to contentSkip to conversation

cfq-iosched: reduce write depth only if sync was delayed

PATCH Corrado Zoccolo 3 participants 3 messages Dec 9, 2009 Block layer

lore
Share & tools
lore
#0 lore raw
Quoted 6 lines · Jens Axboe
Quoted 2 lines · Jeff Moyer

OK. Can we put a comment in there and change the initialization to cfq_slice_sync * 10?

Agree, that would be MUCH easier to understand.

Sure, we can put a comment there, but I don't like hardcoding a constant that depends on how the formula is computed (what if the formula is changed, and it doesn't depend on cfq_slice_sync any more, or if cfq_slice_sync changes dynamically?).
When I wrote it, what I really meant was exactly what you read in the C code (assume the last delayed sync happened 1 second ago). Then, the effect would be to start with a queue depth of 10 with the current formula, but even if we change the formula, 1 second is still meaningful (while 10 *cfq_slice_sync, that has the same value, becomes misleading). So my proposed fix is just:

Quoted 1 line

From f06cd83b45b3a7ee13ae7322197b610085dc70dd Mon Sep 17 00:00:00 2001

From: Corrado Zoccolo <corrado@localhost.(none)>
Date: Wed, 9 Dec 2009 20:40:16 +0100
Subject: [PATCH] cfq-iosched: commenting non-obvious initialization

Added a comment to explain the initialization of last_delayed_sync.

---
 block/cfq-iosched.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
block/cfq-iosched.c +4 -0
index 98b15b9..69ecee7 100644
@@ -3759,6 +3759,10 @@ static void *cfq_init_queue(struct request_queue *q)
 	cfqd->cfq_latency = 1;
 	cfqd->cfq_group_isolation = 0;
 	cfqd->hw_tag = -1;
+	/*
+	 * we optimistically start assuming sync ops weren't delayed in last
+	 * second, in order to have larger depth for async operations.
+	 */
 	cfqd->last_delayed_sync = jiffies - HZ;
 	INIT_RCU_HEAD(&cfqd->rcu);
 	return cfqd;
Signature · 1 line
1.6.2.5
Acked-by
#1 lore raw
Quoted 11 lines · Corrado Zoccolo
Quoted 6 lines · Jens Axboe
Quoted 2 lines · Jeff Moyer

OK. Can we put a comment in there and change the initialization to cfq_slice_sync * 10?

Agree, that would be MUCH easier to understand.

Sure, we can put a comment there, but I don't like hardcoding a constant that depends on how the formula is computed (what if the formula is changed, and it doesn't depend on cfq_slice_sync any more, or if cfq_slice_sync changes dynamically?).

Then presumably you'd change the initialization of that variable.

Quoted 6 lines

When I wrote it, what I really meant was exactly what you read in the C code (assume the last delayed sync happened 1 second ago). Then, the effect would be to start with a queue depth of 10 with the current formula, but even if we change the formula, 1 second is still meaningful (while 10 *cfq_slice_sync, that has the same value, becomes misleading). So my proposed fix is just:

Well, given your initial explanation, my suggestion made sense to me. Given this new explanation, I'm fine with the change below. Thanks for clarifying.

Quoted 27 lines

From f06cd83b45b3a7ee13ae7322197b610085dc70dd Mon Sep 17 00:00:00 2001
From: Corrado Zoccolo <corrado@localhost.(none)>
Date: Wed, 9 Dec 2009 20:40:16 +0100
Subject: [PATCH] cfq-iosched: commenting non-obvious initialization

Added a comment to explain the initialization of last_delayed_sync.

---
 block/cfq-iosched.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
block/cfq-iosched.c +4 -0
index 98b15b9..69ecee7 100644
@@ -3759,6 +3759,10 @@ static void *cfq_init_queue(struct request_queue *q)
 	cfqd->cfq_latency = 1;
 	cfqd->cfq_group_isolation = 0;
 	cfqd->hw_tag = -1;
+	/*
+	 * we optimistically start assuming sync ops weren't delayed in last
+	 * second, in order to have larger depth for async operations.
+	 */
 	cfqd->last_delayed_sync = jiffies - HZ;
 	INIT_RCU_HEAD(&cfqd->rcu);
 	return cfqd;
#2 lore raw
In reply to Corrado Zoccolo
Quoted 30 lines · Corrado Zoccolo
Quoted 6 lines · Jens Axboe
Quoted 2 lines · Jeff Moyer

OK. Can we put a comment in there and change the initialization to cfq_slice_sync * 10?

Agree, that would be MUCH easier to understand.

Sure, we can put a comment there, but I don't like hardcoding a constant that depends on how the formula is computed (what if the formula is changed, and it doesn't depend on cfq_slice_sync any more, or if cfq_slice_sync changes dynamically?).
When I wrote it, what I really meant was exactly what you read in the C code (assume the last delayed sync happened 1 second ago). Then, the effect would be to start with a queue depth of 10 with the current formula, but even if we change the formula, 1 second is still meaningful (while 10 *cfq_slice_sync, that has the same value, becomes misleading). So my proposed fix is just:

From f06cd83b45b3a7ee13ae7322197b610085dc70dd Mon Sep 17 00:00:00 2001
From: Corrado Zoccolo <corrado@localhost.(none)>
Date: Wed, 9 Dec 2009 20:40:16 +0100
Subject: [PATCH] cfq-iosched: commenting non-obvious initialization

Added a comment to explain the initialization of last_delayed_sync.

---
 block/cfq-iosched.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
block/cfq-iosched.c +0 -0
index 98b15b9..69ecee7 100644

block/cfq-iosched.c static void *cfq_init_queue(struct request_queue *q) · line 3766

Quoted 8 lines
block/cfq-iosched.c +4 -0
@@ -3759,6 +3759,10 @@ static void *cfq_init_queue(struct request_queue *q)
 	cfqd->cfq_latency = 1;
 	cfqd->cfq_group_isolation = 0;
 	cfqd->hw_tag = -1;
+	/*
+	 * we optimistically start assuming sync ops weren't delayed in last
+	 * second, in order to have larger depth for async operations.
+	 */
 	cfqd->last_delayed_sync = jiffies - HZ;

Thanks, that explains the HZ nicely. Applied.

Signature · 1 line
Jens Axboe