]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
dm kcopyd: delay unplugging
authorMikulas Patocka <mpatocka@redhat.com>
Thu, 13 Jan 2011 19:59:50 +0000 (19:59 +0000)
committerAlasdair G Kergon <agk@redhat.com>
Thu, 13 Jan 2011 19:59:50 +0000 (19:59 +0000)
commit8d35d3e37eed884ba15229a146df846f399909b4
tree795c77c941229f413750e99242f1b2199bebe7a1
parent4a038677df4da84e42fd68b5ab2dfa4d82baa444
dm kcopyd: delay unplugging

Make kcopyd merge more I/O requests by using device unplugging.

Without this patch, each I/O request is dispatched separately to the device.
If the device supports tagged queuing, there are many small requests sent
to the device. To improve performance, this patch will batch as many requests
as possible, allowing the queue to merge consecutive requests, and send them
to the device at once.

In my tests (15k SCSI disk), this patch improves sequential write throughput:

  Sequential write throughput (chunksize of 4k, 32k, 512k)
  unpatched: 15.2, 18.5, 17.5 MB/s
  patched:   14.4, 22.6, 23.0 MB/s

In most common uses (snapshot or two-way mirror), kcopyd is only used for
two devices, one for reading and the other for writing, thus this optimization
is implemented only for two devices. The optimization may be extended to n-way
mirrors with some code complexity increase.

We keep track of two block devices to unplug (one for read and the
other for write) and unplug them when exiting "do_work" thread.  If
there are more devices used (in theory it could happen, in practice it
is rare), we unplug immediately.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
drivers/md/dm-kcopyd.c