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

2014-08-04 Thread Markus Armbruster
Stefan Hajnoczi writes: > On Thu, Jul 31, 2014 at 05:14:12PM -0400, John Snow wrote: >> >> On 07/31/2014 06:13 AM, Stefan Hajnoczi wrote: >> >On Wed, Jul 30, 2014 at 06:28:28PM -0400, John Snow wrote: >> >>-static uint64_t pc_alloc(QGuestAllocator *allocator, size_t size) >> >>+static inline voi

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

2014-08-01 Thread Stefan Hajnoczi
On Thu, Jul 31, 2014 at 05:14:12PM -0400, John Snow wrote: > > On 07/31/2014 06:13 AM, Stefan Hajnoczi wrote: > >On Wed, Jul 30, 2014 at 06:28:28PM -0400, John Snow wrote: > >>-static uint64_t pc_alloc(QGuestAllocator *allocator, size_t size) > >>+static inline void mlist_insert(MemList *head, Mem

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

2014-07-31 Thread John Snow
On 07/31/2014 06:13 AM, Stefan Hajnoczi wrote: On Wed, Jul 30, 2014 at 06:28:28PM -0400, John Snow wrote: +#define bitany(X, MASK) ((X) & (MASK)) +#define bitset(X, MASK) (bitany((X), (MASK)) == (MASK)) This is subjective but macros like this should be avoided. This macro does not encapsulate

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

2014-07-31 Thread Stefan Hajnoczi
On Wed, Jul 30, 2014 at 06:28:28PM -0400, John Snow wrote: > +#define bitany(X, MASK) ((X) & (MASK)) > +#define bitset(X, MASK) (bitany((X), (MASK)) == (MASK)) This is subjective but macros like this should be avoided. This macro does not encapsulate anything substantial. It forces the reader to

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

2014-07-30 Thread John Snow
Implement a simple first-fit memory allocator that attempts to keep track of leased blocks of memory in order to be able to re-use blocks. Additionally, allow the user to specify when initializing the device that upon cleanup, we would like to assert that there are no blocks in use. This may be us

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

2014-07-30 Thread Stefan Hajnoczi
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 struc

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

2014-07-29 Thread John Snow
Implement a simple first-fit memory allocator that attempts to keep track of leased blocks of memory in order to be able to re-use blocks. Additionally, allow the user to specify when initializing the device that upon cleanup, we would like to assert that there are no blocks in use. This may be us