Skip to contentSkip to conversation

cfq-iosched: convert slice idle time to jiffies

PATCH Superseded Alexandru Moise 2 participants 3 messages Dec 29, 2015 Block layer

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cfq-iosched: convert slice idle time to jiffies

This patch refers to Jens Axboe's change way back in 2006:
7b14e3b52 cfq-iosched: slice expiry fixups

In this patch he fixed a potential timer race condition by delaying idle_slice_timer by the slice_idle time value.

Today this timer is delayed by either slice_idle or group_idle time values, which on my system, and according to Documentation/block/cfq-iosched.txt the default value for both is 8ms.

Since the time given by either variables is supposed to be in milliseconds we should convert that value from milliseconds to jiffies before adding it to jiffies variable and setting our timer.

In my obervations the area is really active as I've seen that function get called a lot for each device on my btrfs raid setup during btrfs check. I've also timed the btrfs check before and after applying the patch and I might've noticed a very slight improvement in execution time but the numbers vary too much for me to post any believable numbers (10 milliseconds difference at most on average).

---
 block/cfq-iosched.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/cfq-iosched.c +1 -1
index 1f9093e..eec65fb 100644
@@ -2958,7 +2958,7 @@ static void cfq_arm_slice_timer(struct cfq_data *cfqd)
 	else
 		sl = cfqd->cfq_slice_idle;
 
-	mod_timer(&cfqd->idle_slice_timer, jiffies + sl);
+	mod_timer(&cfqd->idle_slice_timer, jiffies + msecs_to_jiffies(sl));
 	cfqg_stats_set_start_idle_time(cfqq->cfqg);
 	cfq_log_cfqq(cfqd, cfqq, "arm_idle: %lu group_idle: %d", sl,
 			group_idle ? 1 : 0);
Signature · 1 line
1.9.1
maintainer
#1 lore raw
Quoted 14 lines · Alexandru Moise

This patch refers to Jens Axboe's change way back in 2006:
7b14e3b52 cfq-iosched: slice expiry fixups

In this patch he fixed a potential timer race condition by delaying idle_slice_timer by the slice_idle time value.

Today this timer is delayed by either slice_idle or group_idle time values, which on my system, and according to Documentation/block/cfq-iosched.txt the default value for both is 8ms.

Since the time given by either variables is supposed to be in milliseconds we should convert that value from milliseconds to jiffies before adding it to jiffies variable and setting our timer.

Quoted 6 lines

In my obervations the area is really active as I've seen that function get called a lot for each device on my btrfs raid setup during btrfs check. I've also timed the btrfs check before and after applying the patch and I might've noticed a very slight improvement in execution time but the numbers vary too much for me to post any believable numbers (10 milliseconds difference at most on average).

cfqd->cfq_slice_idle is in jiffies, it's not in msecs.

Signature · 1 line
Jens Axboe
#2 lore raw
Quoted 15 lines · Jens Axboe
Quoted 14 lines · Alexandru Moise

This patch refers to Jens Axboe's change way back in 2006:
7b14e3b52 cfq-iosched: slice expiry fixups

In this patch he fixed a potential timer race condition by delaying idle_slice_timer by the slice_idle time value.

Today this timer is delayed by either slice_idle or group_idle time values, which on my system, and according to Documentation/block/cfq-iosched.txt the default value for both is 8ms.

Since the time given by either variables is supposed to be in milliseconds we should convert that value from milliseconds to jiffies before adding it to jiffies variable and setting our timer.

Quoted 12 lines
Quoted 6 lines

In my obervations the area is really active as I've seen that function get called a lot for each device on my btrfs raid setup during btrfs check. I've also timed the btrfs check before and after applying the patch and I might've noticed a very slight improvement in execution time but the numbers vary too much for me to post any believable numbers (10 milliseconds difference at most on average).

cfqd->cfq_slice_idle is in jiffies, it's not in msecs.

Signature · 1 line
Jens Axboe

Then should I only do the conversion in the case of group_idle?