Skip to contentSkip to conversation

General question (scheduler) with SSDs?

DISCUSSION Justin Piszcz 4 participants 13 messages Feb 19, 2009 – Feb 20, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hello,

I was curious if anyone had done any benchmarks and/or has conclusive information, what is the best Linux scheduler to use with SSDs?

Noop?
CFQ?
AS?
Deadline?

Justin.

#1 lore raw
Quoted 9 lines · Justin Piszcz

Hello,

I was curious if anyone had done any benchmarks and/or has conclusive information, what is the best Linux scheduler to use with SSDs?

Noop?
CFQ?
AS?
Deadline?

There was a thread started on that recently:
http://lkml.org/lkml/2009/1/30/288

#2 lore raw
In reply to Justin Piszcz
Quoted 9 lines · Justin Piszcz

Hello,

I was curious if anyone had done any benchmarks and/or has conclusive information, what is the best Linux scheduler to use with SSDs?

Noop?
CFQ?
AS?
Deadline?

As mentioned in another mail :wq

Signature · 1 line
Sitsofe | http://sucs.org/~sits/
#3 lore raw
In reply to Justin Piszcz

Whoops, I didn't mean to send that previous half formed mail :) Sorry.

Quoted 8 lines · Justin Piszcz

I was curious if anyone had done any benchmarks and/or has conclusive information, what is the best Linux scheduler to use with SSDs?

Noop?
CFQ?
AS?
Deadline?

As mentioned in another mail there was a discussion on
http://lkml.org/lkml/2009/1/31/28 and long thread talking about the introduction of the rotational flag here
http://lkml.org/lkml/2009/1/5/340 . Cheapo SSDs or even USB keys are not auto detected as non-rotational devices by the kernel and after a bit of poking about I've come up with the following udev rules for my particular cases:

SUBSYSTEM=="block", TEST=="/sys$devpath/queue/rotational", ATTRS{model}=="ASUS-PHISON *", RUN+="/bin/sh -c 'echo 0 > /sys$devpath/queue/rotational'" SUBSYSTEM=="block", TEST=="/sys$devpath/queue/rotational", ATTRS{idVendor}=="0951", ATTRS{idProduct}=="1606", RUN+="/bin/sh -c 'echo 0 > /sys$devpath/queue/rotational'" SUBSYSTEM=="block", TEST=="/sys$devpath/queue/rotational", ATTRS{manufacturer}=="SanDisk", ATTRS{product}=="Cruzer Micro", RUN+="/bin/sh -c 'echo 0 > /sys$devpath/queue/rotational'"

Ever since the rotational option appeared I've been trying cfq but prior to that I was using noop or deadline. However it doesn't look like anyone has sat down and run the numbers to see what affect the ioscheulder/rotational flag is having on cheapo SSDs - all the suggestions are anecdotal. Could you run some benchmarks with these different options and report back the results?

Signature · 1 line
Sitsofe | http://sucs.org/~sits/
#4 lore raw
Quoted 14 lines · Sitsofe Wheeler

Whoops, I didn't mean to send that previous half formed mail :) Sorry.

As mentioned in another mail there was a discussion on
http://lkml.org/lkml/2009/1/31/28 and long thread talking about the introduction of the rotational flag here
http://lkml.org/lkml/2009/1/5/340 . Cheapo SSDs or even USB keys are not auto detected as non-rotational devices by the kernel and after a bit of poking about I've come up with the following udev rules for my particular cases:

SUBSYSTEM=="block", TEST=="/sys$devpath/queue/rotational", ATTRS{model}=="ASUS-PHISON *", RUN+="/bin/sh -c 'echo 0 > /sys$devpath/queue/rotational'" SUBSYSTEM=="block", TEST=="/sys$devpath/queue/rotational", ATTRS{idVendor}=="0951", ATTRS{idProduct}=="1606", RUN+="/bin/sh -c 'echo 0 > /sys$devpath/queue/rotational'" SUBSYSTEM=="block", TEST=="/sys$devpath/queue/rotational", ATTRS{manufacturer}=="SanDisk", ATTRS{product}=="Cruzer Micro", RUN+="/bin/sh -c 'echo 0 > /sys$devpath/queue/rotational'"

Quoted 10 lines

Ever since the rotational option appeared I've been trying cfq but prior to that I was using noop or deadline. However it doesn't look like anyone has sat down and run the numbers to see what affect the ioscheulder/rotational flag is having on cheapo SSDs - all the suggestions are anecdotal. Could you run some benchmarks with these different options and report back the results?

Signature · 1 line
Sitsofe | http://sucs.org/~sits/
$ grep rotational -r /usr/src/linux/
/usr/src/linux/drivers/scsi/NCR5380.c: * USLEEP_POLL should be a maximum rotational latency.
/usr/src/linux/fs/partitions/sun.c:             __be16 rspeed;     /* Disk rotational speed */
/usr/src/linux/fs/ufs/ufs_fs.h: * Compute the cylinder and rotational position of a cyl block addr.
/usr/src/linux/fs/ufs/ufs_fs.h: __fs32  fs_nrpos;               /* number of rotational positions */
/usr/src/linux/fs/ufs/ufs_fs.h:#define UFS_42POSTBLFMT          -1      /* 4.2BSD rotational table format */
/usr/src/linux/fs/ufs/ufs_fs.h:#define UFS_DYNAMICPOSTBLFMT     1       /* dynamic rotational table format */
/usr/src/linux/fs/ufs/ufs_fs.h: __s32   s_nrpos;        /* number of rotational positions */
/usr/src/linux/include/linux/blkdev.h:#define QUEUE_FLAG_NONROT      14 /* non-rotational device (SSD) */
/usr/src/linux/include/linux/genhd.h:   __u16   d_rpm;                  /* rotational speed */
# find /sys/|grep -i rotational
#

Which kernel{option} do you enable to enable support for that option in /sys?

Justin.

#5 lore raw
Quoted 3 lines · Justin Piszcz

Which kernel{option} do you enable to enable support for that option in /sys?

It's new to 2.6.29 (it's available in at least 2.6.29rc5). I don't believe I enabled anything special to get it.

Signature · 1 line
Sitsofe | http://sucs.org/~sits/
#6 lore raw
In reply to Sitsofe Wheeler
Quoted 20 lines · Sitsofe Wheeler

Whoops, I didn't mean to send that previous half formed mail :) Sorry.

Quoted 8 lines · Justin Piszcz

I was curious if anyone had done any benchmarks and/or has conclusive information, what is the best Linux scheduler to use with SSDs?

Noop?
CFQ?
AS?
Deadline?

As mentioned in another mail there was a discussion on
http://lkml.org/lkml/2009/1/31/28 and long thread talking about the introduction of the rotational flag here
http://lkml.org/lkml/2009/1/5/340 . Cheapo SSDs or even USB keys are not auto detected as non-rotational devices by the kernel and after a bit of poking about I've come up with the following udev rules for my particular cases:

Quoted 1 line

SUBSYSTEM=="block", TEST=="/sys$devpath/queue/rotational", ATTRS{model}=="ASUS-PHISON *", RUN+="/bin/sh -c 'echo 0 > /sys$devpath/queue/rotational'"

Udev can write to the attribute itself. This should be all you need:
SUSBSYTEM=="block", ATTRS{model}=="ASUS-PHISON *", ATTR{queue/rotational}="1"

Kay

#7 lore raw
Quoted 3 lines · Kay Sievers

Udev can write to the attribute itself. This should be all you need:
SUSBSYTEM=="block", ATTRS{model}=="ASUS-PHISON *", ATTR{queue/rotational}="1"

I tried
SUBSYSTEM=="block", ATTRS{model}=="ASUS-PHISON *", ATTR{queue/rotational}="0" but udevtest /sys/block/sda/ doesn't list it as firing (udev 117-8)...

Signature · 1 line
Sitsofe | http://sucs.org/~sits/
#8 lore raw
Quoted 8 lines · Sitsofe Wheeler
Quoted 3 lines · Kay Sievers

Udev can write to the attribute itself. This should be all you need:
SUSBSYTEM=="block", ATTRS{model}=="ASUS-PHISON *", ATTR{queue/rotational}="1"

I tried
SUBSYSTEM=="block", ATTRS{model}=="ASUS-PHISON *", ATTR{queue/rotational}="0" but udevtest /sys/block/sda/ doesn't list it as firing (udev 117-8)...

I does here:
udev_rules_apply_to_event: ATTR '/sys/devices/ ...
/sdb/queue/rotational' writing '0'

$grep . /sys/class/block/*/queue/rotational
/sys/class/block/sda/queue/rotational:1
/sys/class/block/sdb/queue/rotational:0

Maybe "udevtest" is not showing it for you, or udev 117 is too old and does not work that way.

Thanks,
Kay

#9 lore raw
Quoted 10 lines · Kay Sievers
Quoted 4 lines · Sitsofe Wheeler

I tried
SUBSYSTEM=="block", ATTRS{model}=="ASUS-PHISON *", ATTR{queue/rotational}="0" but udevtest /sys/block/sda/ doesn't list it as firing (udev 117-8)...

I does here:
udev_rules_apply_to_event: ATTR '/sys/devices/ ...
/sdb/queue/rotational' writing '0'

Quoted 6 lines

$grep . /sys/class/block/*/queue/rotational
/sys/class/block/sda/queue/rotational:1
/sys/class/block/sdb/queue/rotational:0

Maybe "udevtest" is not showing it for you, or udev 117 is too old and does not work that way.

After you mentioned this I tried again and seemingly I was mistaken - it does work as you described. I had to make a slight rule tweak to stop it matching on partitions though:

SUBSYSTEM=="block", KERNEL=="[sh]d[a-z]", ATTRS{model}=="ASUS-PHISON *", ATTR{queue/rotational}="0" SUBSYSTEM=="block", KERNEL=="[sh]d[a-z]", ATTRS{idVendor}=="0951", ATTRS{idProduct}=="1606", ATTR{queue/rotational}="0" SUBSYSTEM=="block", KERNEL=="[sh]d[a-z]", ATTRS{manufacturer}=="SanDisk", ATTRS{product}=="Cruzer Micro", ATTR{queue/rotational}="0"

Thanks!

Signature · 1 line
Sitsofe | http://sucs.org/~sits/
#10 lore raw
Quoted 15 lines · Sitsofe Wheeler
Quoted 14 lines · Kay Sievers
Quoted 4 lines · Sitsofe Wheeler

I tried
SUBSYSTEM=="block", ATTRS{model}=="ASUS-PHISON *", ATTR{queue/rotational}="0" but udevtest /sys/block/sda/ doesn't list it as firing (udev 117-8)...

I does here:
udev_rules_apply_to_event: ATTR '/sys/devices/ ...
/sdb/queue/rotational' writing '0'

$grep . /sys/class/block/*/queue/rotational
/sys/class/block/sda/queue/rotational:1
/sys/class/block/sdb/queue/rotational:0

Quoted 5 lines
Quoted 2 lines

Maybe "udevtest" is not showing it for you, or udev 117 is too old and does not work that way.

After you mentioned this I tried again and seemingly I was mistaken - it does work as you described.

Great.

Quoted 4 lines

I had to make a slight rule tweak to stop
it matching on partitions though:

SUBSYSTEM=="block", KERNEL=="[sh]d[a-z]", ATTRS{model}=="ASUS-PHISON *", ATTR{queue/rotational}="0"

Newer kernels have DEVTYPE in the envent environment, and:
ENV{DEVTYPE}=="disk"
can be used, which is easier and more reliable.

Also the whitespace after "...PHISON *" does not need to be matched. If the match value does not end in whitespace itself, udev will match against the value with all trailing whitespace ignored.

Kay

#11 lore raw
Quoted 3 lines · Kay Sievers

Also the whitespace after "...PHISON *" does not need to be matched. If the match value does not end in whitespace itself, udev will match against the value with all trailing whitespace ignored.

Ah, I'm not matching against only whitespace:

$ cat /sys/block/*/device/model 
ASUS-PHISON OB S
ASUS-PHISON SSD 

(the first is the builtin faster SSD, the other is the slower removable SSD).

Signature · 1 line
Sitsofe | http://sucs.org/~sits/
#12 lore raw
Quoted 5 lines · Sitsofe Wheeler
Quoted 3 lines · Kay Sievers

Also the whitespace after "...PHISON *" does not need to be matched. If the match value does not end in whitespace itself, udev will match against the value with all trailing whitespace ignored.

Quoted 8 lines

Ah, I'm not matching against only whitespace:

$ cat /sys/block/*/device/model
ASUS-PHISON OB S
ASUS-PHISON SSD

(the first is the builtin faster SSD, the other is the slower removable SSD).

Ah, I see, then nothing to complain from my side anymore. :)

Thanks,
Kay