mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
move munmap() workaround to from unit test to memory_free_hugepage()
This commit is contained in:
parent
f13c6c14e4
commit
7baffe66c0
3 changed files with 6 additions and 5 deletions
|
@ -13,6 +13,8 @@
|
|||
#ifndef _MEMORY_H_
|
||||
#define _MEMORY_H_
|
||||
|
||||
#define HUGEPAGESIZE (1 << 21)
|
||||
|
||||
typedef void *(*memzone_allocator_t)(size_t len);
|
||||
typedef int (*memzone_deallocator_t)(void *ptr, size_t len);
|
||||
|
||||
|
|
|
@ -65,6 +65,8 @@ static void * memory_hugepage_alloc(size_t len)
|
|||
|
||||
static int memory_hugepage_free(void *ptr, size_t len)
|
||||
{
|
||||
len = ALIGN(len, HUGEPAGESIZE); /* ugly see: https://lkml.org/lkml/2015/3/27/171 */
|
||||
|
||||
return munmap(ptr, len);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
#include "memory.h"
|
||||
#include "utils.h"
|
||||
|
||||
#define HUGEPAGESIZE (1 << 21)
|
||||
|
||||
TheoryDataPoints(memory, aligned) = {
|
||||
// DataPoints(size_t, 1, 32, 55, 1 << 10, 1 << 20),
|
||||
DataPoints(size_t, 1<<12),
|
||||
|
@ -31,12 +29,11 @@ Theory((size_t len, size_t align, const struct memtype *m), memory, aligned) {
|
|||
cr_assert_neq(ptr, NULL, "Failed to allocate memory");
|
||||
|
||||
//cr_assert(IS_ALIGNED(ptr, align));
|
||||
|
||||
|
||||
if (m == &memtype_hugepage) {
|
||||
cr_assert(IS_ALIGNED(ptr, HUGEPAGESIZE));
|
||||
len = ALIGN(len, HUGEPAGESIZE); /* ugly see: https://lkml.org/lkml/2015/3/27/171 */
|
||||
}
|
||||
|
||||
|
||||
ret = memory_free(m, ptr, len);
|
||||
cr_assert_eq(ret, 0, "Failed to release memory: ret=%d, ptr=%p, len=%zu: %s", ret, ptr, len, strerror(errno));
|
||||
}
|
Loading…
Add table
Reference in a new issue