From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:51245) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTYkd-0008Lg-4q for qemu-devel@nongnu.org; Wed, 31 Oct 2012 09:54:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TTYkc-0003sE-5A for qemu-devel@nongnu.org; Wed, 31 Oct 2012 09:54:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:4375) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTYkb-0003s6-T4 for qemu-devel@nongnu.org; Wed, 31 Oct 2012 09:54:34 -0400 Message-ID: <509127DC.5000707@redhat.com> Date: Wed, 31 Oct 2012 14:30:04 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1351688609-18984-1-git-send-email-stefanha@redhat.com> In-Reply-To: <1351688609-18984-1-git-send-email-stefanha@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] aio: Use g_slice_alloc() for AIOCB pooling List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , Anthony Liguori , qemu-devel@nongnu.org Il 31/10/2012 14:03, Stefan Hajnoczi ha scritto: > AIO control blocks are frequently acquired and released because each aio > request involves at least one AIOCB. Therefore pool them to avoid heap > allocation overhead. > > The problem with the freelist approach in AIOPool is thread-safety. If > we want BlockDriverStates to associate with AioContexts that execute in > multiple threads, then a global freelist becomes a problem. > > This patch drops the freelist and instead uses g_slice_alloc() which is > tuned for per-thread fixed-size object pools. qemu_aio_get() and > qemu_aio_release() are now thread-safe. > > Note that the change from g_malloc0() to g_slice_alloc() should be safe > since the freelist reuse case doesn't zero the AIOCB either. > > Signed-off-by: Stefan Hajnoczi Good idea, should of course be split in multiple patches. :) Paolo