On 13/05/2015 18:46, Denis V. Lunev wrote:
> I agree with this. Kernel guys are aware and may be we will have
> the fix after a while... I have heard (not tested) that performance
> loss over multi-queue SSD is around 30%.
I came up with this patch... can you test it with your test case
(and old QEMU) to see if it works for you? I don't see much
improvement, but neither do I see it with new QEMU.
Paolo
diff --git a/block/bio.c b/block/bio.c
index f66a4eae16ee..df5bde7ebded 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -705,6 +705,7 @@ static int __bio_add_page(struct request_queue *q, struct
bio *bio, struct page
{
int retried_segments = 0;
struct bio_vec *bvec;
+ int speculative_len;
/*
* cloned bio must not modify vec list
@@ -712,7 +713,16 @@ static int __bio_add_page(struct request_queue *q, struct
bio *bio, struct page
if (unlikely(bio_flagged(bio, BIO_CLONED)))
return 0;
- if (((bio->bi_iter.bi_size + len) >> 9) > max_sectors)
+ /*
+ * If the bio is not page-aligned, stop if we cannot fit this entire
+ * page in the vector. This is a very large write, so we'd like
+ * to split it so as to keep the remaining bios aligned.
+ */
+ speculative_len = len;
+ if (bio->bi_iter.bi_size & (PAGE_SIZE - 1) && offset == 0)
+ speculative_len = PAGE_SIZE;
+
+ if (((bio->bi_iter.bi_size + speculative_len) >> 9) > max_sectors)
return 0;
/*