[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 1/4] xen/dmalloc: Introduce dmalloc() APIs
On 23.12.2020 17:34, Andrew Cooper wrote: > --- /dev/null > +++ b/xen/common/dmalloc.c > @@ -0,0 +1,19 @@ > +#include <xen/dmalloc.h> > +#include <xen/sched.h> > +#include <xen/xmalloc.h> > + > +void dfree(struct domain *d, void *ptr) > +{ > + atomic_dec(&d->dalloc_heap); > + xfree(ptr); > +} > + > +void *_dzalloc(struct domain *d, size_t size, size_t align) > +{ > + void *ptr = _xmalloc(size, align); > + > + if ( ptr ) > + atomic_inc(&d->dalloc_heap); While this is properly conditional, the freeing side also needs to tolerate NULL coming in (noticed only while looking at patch 2). I also wonder whether ZERO_BLOCK_PTR wants special casing. Jan
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |