Move OS_PAGE_SIZE to PAL

This commit is contained in:
Nathaniel Filardo
2020-05-12 03:21:31 +00:00
parent b2ee1902dc
commit 44e9abe888
11 changed files with 45 additions and 31 deletions

View File

@@ -92,18 +92,7 @@ namespace snmalloc
// Used to isolate values on cache lines to prevent false sharing.
static constexpr size_t CACHELINE_SIZE = 64;
// Used to keep Superslab metadata committed.
static constexpr size_t OS_PAGE_SIZE = 0x1000;
static constexpr size_t PAGE_ALIGNED_SIZE = OS_PAGE_SIZE << INTERMEDIATE_BITS;
// Some system headers (e.g. Linux' sys/user.h, FreeBSD's machine/param.h)
// define `PAGE_SIZE` as a macro. We don't use `PAGE_SIZE` as our variable
// name, to avoid conflicts, but if we do see a macro definition then check
// that our value matches the platform's expected value.
#ifdef PAGE_SIZE
static_assert(
PAGE_SIZE == OS_PAGE_SIZE,
"Page size from system header does not match snmalloc config page size.");
#endif
// Minimum allocation size is space for two pointers.
static_assert(bits::next_pow2_const(sizeof(void*)) == sizeof(void*));

View File

@@ -1,6 +1,6 @@
#pragma once
#include "../pal/pal_consts.h"
#include "../pal/pal.h"
#include "allocconfig.h"
namespace snmalloc