Loop devices not supported concurrent access ?

From: Gregory Auzanneau
Date: Sat Jan 08 2011 - 20:17:11 EST


Hello All,

During some tests, I've remark an interesting issue with loop devices.
loop devices queues concurrent access by multi-threaded software.

This issue can easily be highlighted by this tool : http://box.houkouonchi.jp/seeker_baryluk.c
This tool permit to test how many iop/s your system can handle (don't forget to use deadline scheduler).

First of all, we will define a loop device on a raw device (raw device permit to avoid filesystem interaction) :
losetup /dev/loop1 /dev/sda5

Now we will test the number our raw device and our loop device can handle with only one thread :
./seeker_baryluk /dev/sda5 1 => Results: 196 seeks/second, 5.081 ms random access time
./seeker_baryluk /dev/loop1 1 => Results: 194 seeks/second, 5.131 ms random access time

Results : raw device and loop device have approximately the same performance with one thread.

Here is the problem : we will now test with 32 threads :
./seeker_baryluk /dev/sda5 32 => Results: 631 seeks/second, 1.585 ms random access time
./seeker_baryluk /dev/loop1 32 => Results: 194 seeks/second, 5.148 ms random access time

As you can see, loop device deals request one by one even with parrallel request.
This involve that we lost a lot of performance performed by NCQ/TCQ and/or disk balancing.

The same thing also appears in Xen when mapping a disk with a "file".

Is this problem solvable ?



/Thank you all for the good work with linux, keep up with it ! :)

Greg

/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/