From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33318) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YB4Ln-0005J2-8p for qemu-devel@nongnu.org; Tue, 13 Jan 2015 11:29:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YB4Li-0008PU-6Q for qemu-devel@nongnu.org; Tue, 13 Jan 2015 11:29:51 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55304) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YB4Lh-0008PH-Uv for qemu-devel@nongnu.org; Tue, 13 Jan 2015 11:29:46 -0500 Message-ID: <54B547F6.5030005@redhat.com> Date: Tue, 13 Jan 2015 11:29:42 -0500 From: John Snow MIME-Version: 1.0 References: <1421120079-987-1-git-send-email-jsnow@redhat.com> <1421120079-987-2-git-send-email-jsnow@redhat.com> <20150113095425.63defa1a@crunchbang> In-Reply-To: <20150113095425.63defa1a@crunchbang> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 01/14] libqos: Split apart pc_alloc_init List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?TWFyYyBNYXLDrQ==?= Cc: kwolf@redhat.com, armbru@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, mreitz@redhat.com On 01/13/2015 03:54 AM, Marc Mar=C3=AD wrote: > El Mon, 12 Jan 2015 22:34:26 -0500 > John Snow escribi=C3=B3: >> Move the list-specific initialization over into >> malloc.c, to keep all of the list implementation >> details within the same file. >> >> The allocation and freeing of these structures are >> now both back within the same layer. >> >> Signed-off-by: John Snow >> --- >> tests/libqos/malloc-pc.c | 20 ++++---------------- >> tests/libqos/malloc.c | 17 +++++++++++++++++ >> tests/libqos/malloc.h | 1 + >> 3 files changed, 22 insertions(+), 16 deletions(-) >> >> diff --git a/tests/libqos/malloc-pc.c b/tests/libqos/malloc-pc.c >> index c9c48fd..36a0740 100644 >> --- a/tests/libqos/malloc-pc.c >> +++ b/tests/libqos/malloc-pc.c >> @@ -32,31 +32,19 @@ void pc_alloc_uninit(QGuestAllocator *allocator) >> >> QGuestAllocator *pc_alloc_init_flags(QAllocOpts flags) >> { >> - QGuestAllocator *s =3D g_malloc0(sizeof(*s)); >> + QGuestAllocator *s; >> uint64_t ram_size; >> QFWCFG *fw_cfg =3D pc_fw_cfg_init(); >> - MemBlock *node; >> + >> + ram_size =3D qfw_cfg_get_u64(fw_cfg, FW_CFG_RAM_SIZE); >> + s =3D alloc_init(1 << 20, MIN(ram_size, 0xE0000000)); >> >> s->opts =3D flags; >> s->page_size =3D PAGE_SIZE; > > Is there a reason to leave page_size out of the function? (flags is > considered in a patch later, ok). I think it would be interesting to > have both, so pc_alloc_init_flags can forget about the fields in > QGuestAllocator. > > Thanks > Marc > There was no strong motivation, I just saw it as something that perhaps=20 other architectures may want to change. A setter method would also work well for not needing to know the=20 internal representation of the allocator object. Thanks, --js