From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58458) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YzN5J-0005yy-AY for qemu-devel@nongnu.org; Mon, 01 Jun 2015 06:36:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YzN5I-00011q-Dv for qemu-devel@nongnu.org; Mon, 01 Jun 2015 06:36:45 -0400 Sender: Dmitry Monakhov From: Dmitry Monakhov In-Reply-To: <5568974C.6080502@redhat.com> References: <1430746944-27347-1-git-send-email-den@openvz.org> <20150511150817.GK16270@stefanha-thinkpad.redhat.com> <5550D3B5.2050703@openvz.org> <5550DD2D.8000407@odin.com> <20150512100155.GB11497@stefanha-thinkpad.redhat.com> <5551D39E.1020902@odin.com> <5551DA21.7020105@redhat.com> <20150513154342.GB24352@stefanha-thinkpad.redhat.com> <55538001.90207@odin.com> <5568974C.6080502@redhat.com> Date: Mon, 01 Jun 2015 13:34:00 +0300 Message-ID: <877frn90pz.fsf@openvz.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Subject: Re: [Qemu-devel] [PATCH v5 0/2] block: enforce minimal 4096 alignment in qemu_blockalign List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , "Denis V. Lunev" , Stefan Hajnoczi Cc: Dmitry Monakhov , Stefan Hajnoczi , qemu-block@nongnu.org, qemu-devel@nongnu.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Paolo Bonzini writes: > 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. Yes. Improvement is not huge, but it can be detected for old qemu unpatched kernel: 728 MiB/sec +/- 20Mb patched kernel : 748 MiB/sec +/- 10Mb IMHO patch is not sufficient. We have to correct bio construction inside direct-io code. I'll be back with the patch. > > 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, st= ruct bio *bio, struct page > { > int retried_segments =3D 0; > struct bio_vec *bvec; > + int speculative_len; >=20=20 > /* > * cloned bio must not modify vec list > @@ -712,7 +713,16 @@ static int __bio_add_page(struct request_queue *q, s= truct bio *bio, struct page > if (unlikely(bio_flagged(bio, BIO_CLONED))) > return 0; >=20=20 > - 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 =3D len; > + if (bio->bi_iter.bi_size & (PAGE_SIZE - 1) && offset =3D=3D 0) > + speculative_len =3D PAGE_SIZE; > + > + if (((bio->bi_iter.bi_size + speculative_len) >> 9) > max_sectors) > return 0; >=20=20 > /* --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBCgAGBQJVbDUZAAoJELhyPTmIL6kBd+QIALJTUArzorFDuO8zE+I6OIvr sLV/jjqRUQwOhbxk+SVzAXDl+rt2SqPKRz36b2nsOlDiBD1Y1pXULZRda9+nEw5Q n5z/8OxY+W5eJsMN8FODy25TV2VhRjSA4HbBgvKvY5o/G1SnoclNHoylq0nx2XkR /BpBWBt0Wc0r/pLN+S30pm1917ohsK3AZq2dSIQkIY3/06hx69AUDvoAvzsez6sQ OIY6HSQtYkoqAeYUlm4VEj/0vMyydAV7ABTVFyTqheLsy+xd/j8rkTUCJYut+Wbw YjN56aVuplGjs2+O48jxobYBg4vfNOcpnbJ091JFIFRYKwic9A3r/Q2TV6q1jLw= =uYiJ -----END PGP SIGNATURE----- --=-=-=--