From b9f07f209b2359fefde1989a86d0b9e4d2404d0b Mon Sep 17 00:00:00 2001 From: Simon Kuenzer Date: Thu, 12 Nov 2020 16:24:41 +0100 Subject: [PATCH] lib/ukalloc: Move ifpages comment Moves the comment about the ifpages implementation within `alloc.c` to the correct place. Signed-off-by: Simon Kuenzer Reviewed-by: Cezar Craciunoiu Tested-by: Unikraft CI GitHub-Pull-Request: #229 --- lib/ukalloc/alloc.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/lib/ukalloc/alloc.c b/lib/ukalloc/alloc.c index 7cdba5e70..98a0e94f1 100644 --- a/lib/ukalloc/alloc.c +++ b/lib/ukalloc/alloc.c @@ -32,19 +32,6 @@ * POSSIBILITY OF SUCH DAMAGE. */ -/* This is a very simple, naive implementation of malloc. - * It's not space-efficient, because it always requests full pages from the - * underlying memory allocator. It's also not very fast, because for the - * same reason, it will never hand out memory from already-requested pages, - * and has to go through the underlying memory allocator on every malloc() - * and free() (and friends. And God have mercy on your soul if you call free() - * with a pointer that wasn't received from malloc(). But it's simple, and, - * above all, it is inherently reentrant, because all bookkeeping is - * decentralized. This is important, because we currently don't have proper - * locking support yet. Eventually, this should probably be replaced by - * something better. - */ - #include #include #include @@ -125,6 +112,18 @@ static size_t uk_getmallocsize(const void *ptr) __PAGE_SIZE - (size_t)ptr; } +/* This is a very simple, naive implementation of malloc. + * It's not space-efficient, because it always requests full pages from the + * underlying memory allocator. It's also not very fast, because for the + * same reason, it will never hand out memory from already-requested pages, + * and has to go through the underlying memory allocator on every malloc() + * and free() (and friends. And God have mercy on your soul if you call free() + * with a pointer that wasn't received from malloc(). But it's simple, and, + * above all, it is inherently reentrant, because all bookkeeping is + * decentralized. This is important, because we currently don't have proper + * locking support yet. Eventually, this should probably be replaced by + * something better. + */ void *uk_malloc_ifpages(struct uk_alloc *a, size_t size) { uintptr_t intptr; -- 2.39.5