From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54533) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XsqKI-00085r-9S for qemu-devel@nongnu.org; Mon, 24 Nov 2014 04:53:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XsqK9-0004ZP-5W for qemu-devel@nongnu.org; Mon, 24 Nov 2014 04:52:58 -0500 Received: from mail-wi0-x234.google.com ([2a00:1450:400c:c05::234]:44528) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XsqK8-0004Y7-UO for qemu-devel@nongnu.org; Mon, 24 Nov 2014 04:52:49 -0500 Received: by mail-wi0-f180.google.com with SMTP id n3so5142170wiv.1 for ; Mon, 24 Nov 2014 01:52:47 -0800 (PST) Sender: Paolo Bonzini Message-ID: <5472FFEA.2080806@redhat.com> Date: Mon, 24 Nov 2014 10:52:42 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1415286601-30715-1-git-send-email-ming.lei@canonical.com> <1415286601-30715-3-git-send-email-ming.lei@canonical.com> <546B525F.3070001@redhat.com> In-Reply-To: <546B525F.3070001@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 2/3] linux-aio: handling -EAGAIN for !s->io_q.plugged case List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Ming Lei , qemu-devel@nongnu.org, Peter Maydell , Stefan Hajnoczi , Kevin Wolf Cc: =?windows-1252?Q?Beno=EEt_Canet?= On 18/11/2014 15:06, Paolo Bonzini wrote: >> > + /* don't submit until next completion for -EAGAIN of non plug case */ >> > + if (unlikely(!s->io_q.plugged)) { >> > + return 0; >> > + } >> > + > Is this an optimization or a fix for something? Ah, if !io_q.plugged we must be in the -EAGAIN case, so no need to "submit immediately if queue depth is above 2/3". Can you rewrite the comment like this: /* This is reached in two cases: queue not plugged but io_submit * returned -EAGAIN, or queue plugged. In the latter case, start * submitting some I/O if the queue is getting too full. In the * former case, instead, wait until an I/O operation is completed. */ if (likely(idx <= s->io_q.size * 2 / 3) || unlikely(!s->io_q.plugged) { return 0; } Paolo