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

[UNIKRAFT PATCH v2 1/2] lib/ukallocpool: Always provide `uk_alloc_availmem()`, `uk_alloc_maxalloc()`



Adopts to the changed meaning of `CONFIG_LIBUKALLLC_IFSTATS` and provide
`uk_alloc_availmem()` and `uk_alloc_maxalloc()` always.

Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
---
 lib/ukallocpool/pool.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/lib/ukallocpool/pool.c b/lib/ukallocpool/pool.c
index 390f6b92..0ff24c38 100644
--- a/lib/ukallocpool/pool.c
+++ b/lib/ukallocpool/pool.c
@@ -208,14 +208,19 @@ void uk_allocpool_return_batch(struct uk_allocpool *p,
                _prepend_free_obj(p, obj[i]);
 }
 
-#if CONFIG_LIBUKALLOC_IFSTATS
 static ssize_t pool_availmem(struct uk_alloc *a)
 {
        struct uk_allocpool *p = ukalloc2pool(a);
 
-       return (size_t) p->free_obj_count * p->obj_len;
+       return (ssize_t) (p->free_obj_count * p->obj_len);
+}
+
+static ssize_t pool_maxalloc(struct uk_alloc *a)
+{
+       struct uk_allocpool *p = ukalloc2pool(a);
+
+       return (ssize_t) p->obj_len;
 }
-#endif
 
 size_t uk_allocpool_reqmem(unsigned int obj_count, size_t obj_len,
                           size_t obj_align)
@@ -300,6 +305,8 @@ out:
                             pool_free,
                             pool_posix_memalign,
                             uk_memalign_compat,
+                            pool_maxalloc,
+                            pool_availmem,
                             NULL);
 #if CONFIG_LIBUKALLOC_IFSTATS
        p->self.availmem = pool_availmem;
-- 
2.20.1



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.