Received: from eggs.gnu.org ([2001:4830:134:3::10]:49820) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bMz9k-0005Qq-Gs for qemu-devel@nongnu.org; Tue, 12 Jul 2016 10:59:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bMz9h-0007RP-6q for qemu-devel@nongnu.org; Tue, 12 Jul 2016 10:59:28 -0400 Received: from mail-lf0-x241.google.com ([2a00:1450:4010:c07::241]:36311) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bMz9g-0007R7-VR for qemu-devel@nongnu.org; Tue, 12 Jul 2016 10:59:25 -0400 Received: by mail-lf0-x241.google.com with SMTP id 33so1185618lfw.3 for ; Tue, 12 Jul 2016 07:59:24 -0700 (PDT) Sender: Paolo Bonzini References: <1467045468-25709-1-git-send-email-stefanha@redhat.com> <20160628094222.GD2798@stefanha-x1.localdomain> From: Paolo Bonzini Message-ID: <60c4eaef-cc41-3510-644a-b3023a6e493c@redhat.com> Date: Tue, 12 Jul 2016 16:59:12 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH] linux-aio: keep processing events if MAX_EVENTS reached List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Roman Penyaev , Stefan Hajnoczi Cc: Kevin Wolf , qemu-devel , Stefan Hajnoczi On 12/07/2016 16:12, Roman Penyaev wrote: > But what is the most important thing here is, that reverting > "linux-aio: Cancel BH if not needed" brings these numbers: > > READ: io=56362MB, aggrb=1878.4MB/s, minb=1878.4MB/s, > maxb=1878.4MB/s, mint=30007msec, maxt=30007msec > WRITE: io=56255MB, aggrb=1874.8MB/s, minb=1874.8MB/s, > maxb=1874.8MB/s, mint=30007msec, maxt=30007msec > > So, it seems to me that "linux-aio: Cancel BH if not needed" introduces > regression. It's possible that this depends on the workload. But, thanks for measuring it. It's not a small effect (~5%). We should consider indeed reverting the patch. > - unsigned int n; > + unsigned int inqueue; > + unsigned int inflight; Please use in_queue (or queue_length) and in_flight. > @@ -203,9 +206,12 @@ static void ioq_submit(LinuxAioState *s) > > do { > len = 0; > + if (s->io_q.inflight >= MAX_EVENTS) > + break; > QSIMPLEQ_FOREACH(aiocb, &s->io_q.pending, next) { > iocbs[len++] = &aiocb->iocb; > - if (len == MAX_QUEUED_IO) { > + if (len == MAX_QUEUED_IO || > + (s->io_q.inflight + len) >= MAX_EVENTS) { Interesting! I suggest an additional cleanup here, which is to replace MAX_QUEUED_IO with MAX_EVENTS everywhere and remove the "len == MAX_QUEUED_IO" part. Also, please remove the parentheses on the left of >=. > if (!s->io_q.blocked && > - (!s->io_q.plugged || s->io_q.n >= MAX_QUEUED_IO)) { > + (!s->io_q.plugged || s->io_q.inqueue >= MAX_QUEUED_IO)) { This should now be s->io_q.inflight + s->io_q.inqueue >= MAX_EVENTS (the logic is: if we can do a "full" io_submit, do it). Thanks! Paolo