The device-mapper (DM) traditionally didn’t have its own I/O scheduler. Then why suddenly my DM devices have such a scheduler and what does it control?
A new type of device-mapper was introduced recently in the Linux kernel 2.6.31 – the request-based device-mapper. According to the Linux Kernel Newbies changelog for 2.6.31, there is a commit which does “Prepare for request based option”.
The issue is actually not in the new request-based DM option, which is to be used only for multipath block devices. The problem is that when you create a regular LVM device on kernels 2.6.31+, the DM device itself has I/O scheduler parameters. So does the underlying block device on top of which you created the LVM. Thus we are having two I/O schedulers in the path from the LVM device to the physical storage.
According to the author of the kernel patches for the request-based DM device, Kiyoshi Ueda, for a bio-based DM device, only the underlying device’s scheduler should affect performance. This is what my tests shown too, therefore there is no discrepancy.
Let me summarize this:
- If you are *not* using multipath block devices in your DM/LVM setup, then only the underlying device’s scheduler (i.e. “/sys/block/sda/queue/scheduler”) takes effect. This applies for the trivial LVM setup which many of us used for years.
- If you are using a multipath DM/LVM setup, then only the DM device’s scheduler (i.e. “/sys/block/dm-0/queue/scheduler”) takes effect.
References:
- Request-based Device-mapper multipath and Dynamic load balancing PDF paper by Kiyoshi Ueda, Jun’ichi Nomura, and Mike Christie. You can also download my copy of this PDF.
- Using Device-Mapper Multipath by RedHat.
October 17, 2012 at 11:38 am
This is the answer what I was looking for. Do you know how it’s now in 3.x line kernel?
October 17, 2012 at 2:47 pm
Things seem even better on my test box with Ubuntu server having kernel “3.2.0-29-generic”. Kernel developers cleared up all confusion. The “dm-0” scheduler has only one possible value when used with LVM — “none”. Example:
famzah@VBox:~$ cat /sys/block/dm-0/queue/scheduler
none