In raid10, all write requests are dispatched in raid10d thread. In fast storage, the raid10d thread is a bottleneck, because it dispatches request too slow. Also raid10d thread migrates freely, which makes request completion cpu not match with submission cpu even driver/block layer has such capability. This will cause bad cache issue. If no bitmap, there is no point to queue bio to a thread and dispatch it in the thread. Directly dispatching bio doesn't impact correctness and removes above bottleneck. Multiple threads dispatch requests could potentially reduce request merge and increase lock contention. For slow stroage, we just worry about request merge. Caller of .make_request should already have correct block plug set, which will take care of request merge and locking just like accessing raw device, so we don't need worry about this too much. In a 4k randwrite test with a 4 disks setup, below patch can provide 95% ~ 135% performance improvements depending on numa binding. Signed-off-by: Shaohua Li <shli@xxxxxxxxxxxx> --- drivers/md/raid10.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) Index: linux/drivers/md/raid10.c =================================================================== --- linux.orig/drivers/md/raid10.c 2012-05-22 19:05:52.495894815 +0800 +++ linux/drivers/md/raid10.c 2012-05-22 19:06:30.955411279 +0800 @@ -1304,10 +1304,13 @@ retry_write: mbio->bi_private = r10_bio; atomic_inc(&r10_bio->remaining); - spin_lock_irqsave(&conf->device_lock, flags); - bio_list_add(&conf->pending_bio_list, mbio); - conf->pending_count++; - spin_unlock_irqrestore(&conf->device_lock, flags); + if (mddev->bitmap) { + spin_lock_irqsave(&conf->device_lock, flags); + bio_list_add(&conf->pending_bio_list, mbio); + conf->pending_count++; + spin_unlock_irqrestore(&conf->device_lock, flags); + } else + generic_make_request(mbio); if (!r10_bio->devs[i].repl_bio) continue; @@ -1329,10 +1332,13 @@ retry_write: mbio->bi_private = r10_bio; atomic_inc(&r10_bio->remaining); - spin_lock_irqsave(&conf->device_lock, flags); - bio_list_add(&conf->pending_bio_list, mbio); - conf->pending_count++; - spin_unlock_irqrestore(&conf->device_lock, flags); + if (mddev->bitmap) { + spin_lock_irqsave(&conf->device_lock, flags); + bio_list_add(&conf->pending_bio_list, mbio); + conf->pending_count++; + spin_unlock_irqrestore(&conf->device_lock, flags); + } else + generic_make_request(mbio); } /* Don't remove the bias on 'remaining' (one_write_done) until -- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html