qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 3/4] libqos: add a simple first-fit memory alloc


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH 3/4] libqos: add a simple first-fit memory allocator
Date: Wed, 30 Jul 2014 16:24:50 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

On Tue, Jul 29, 2014 at 05:54:43PM -0400, John Snow wrote:
> diff --git a/tests/libqos/malloc-pc.c b/tests/libqos/malloc-pc.c
> index 2efd095..410181d 100644
> --- a/tests/libqos/malloc-pc.c
> +++ b/tests/libqos/malloc-pc.c
> @@ -21,41 +21,336 @@
>  
>  #define PAGE_SIZE (4096)
>  
> +typedef struct mem_block {

QEMU generally uses CamelCase for struct tags too.  The name can be the
same as the typedef (MemBlock).

> +    struct mem_block *prev;
> +    struct mem_block *next;

Please see include/qemu/queue.h for variants of linked lists.  QTAILQ
should work, then you can drop your custom doubly-linked list code.

> +            fprintf(stderr, "guest malloc leak @ 0x%016lx size 0x%016lx\n",
> +                    node->addr, node->size);

On 32-bit hosts %lx is 32-bit but addr is uint64_t.  Please use the
PRIx64 macro here and for other instances in this patch.

Attachment: pgp47UDxI04ZQ.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]