From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50074) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YO4LE-00011u-1Q for qemu-devel@nongnu.org; Wed, 18 Feb 2015 08:07:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YO4L9-0007MV-1n for qemu-devel@nongnu.org; Wed, 18 Feb 2015 08:06:59 -0500 Received: from mail-we0-f173.google.com ([74.125.82.173]:41814) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YO4L8-0007MP-Q7 for qemu-devel@nongnu.org; Wed, 18 Feb 2015 08:06:54 -0500 Received: by wevm14 with SMTP id m14so1013139wev.8 for ; Wed, 18 Feb 2015 05:06:54 -0800 (PST) Sender: Paolo Bonzini Message-ID: <54E48E69.6080308@redhat.com> Date: Wed, 18 Feb 2015 14:06:49 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <20150218115534.4176.12578.stgit@PASHA-ISP> <20150218115710.4176.28907.stgit@PASHA-ISP> In-Reply-To: <20150218115710.4176.28907.stgit@PASHA-ISP> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC PATCH v9 15/23] aio: replace stack of bottom halves with queue List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pavel Dovgalyuk , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, alex.bennee@linaro.org, mark.burton@greensocs.com, real@ispras.ru, batuzovk@ispras.ru, maria.klimushenkova@ispras.ru, afaerber@suse.de, fred.konrad@greensocs.com On 18/02/2015 12:57, Pavel Dovgalyuk wrote: > + QSIMPLEQ_FOREACH_SAFE(bh, &ctx->bh_queue, next, next) { > if (bh->deleted) { > - *bhp = bh->next; > + QSIMPLEQ_REMOVE(&ctx->bh_queue, bh, QEMUBH, next); QSIMPLEQ_REMOVE is very inefficient, so that this loop can become O(n^2). You could use QTAILQ or introduce QSIMPLE_REMOVE_AFTER. Paolo > g_free(bh); > - } else { > - bhp = &bh->next; > }