From f500cfa1e61c44ce3ec14e3910d7c7d3fa813610 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Mon, 2 Jul 2018 10:51:27 +0200 Subject: [PATCH] memory: update link and explanation of munmap() on hugepages --- lib/memory.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/memory.c b/lib/memory.c index 4877ee01a..246be848a 100644 --- a/lib/memory.c +++ b/lib/memory.c @@ -147,7 +147,11 @@ static void * memory_hugepage_alloc(struct memtype *m, size_t len, size_t alignm static int memory_hugepage_free(struct memtype *m, void *ptr, size_t len) { - len = ALIGN(len, HUGEPAGESIZE); /* ugly see: https://lkml.org/lkml/2015/3/27/171 */ + /** We must make sure that len is a multiple of the hugepage size + * + * See: https://lkml.org/lkml/2014/10/22/925 + */ + len = ALIGN(len, HUGEPAGESIZE); return munmap(ptr, len); }