diff options
author | Geir Storli <geirst@yahooinc.com> | 2022-11-25 12:21:13 +0000 |
---|---|---|
committer | Geir Storli <geirst@yahooinc.com> | 2022-11-25 12:21:13 +0000 |
commit | 2e758530c2dfc2bc665a980da7b5c60d778e8a52 (patch) | |
tree | 399f3bede2ba3f39867e38306fff2812ded8324c /vespalib | |
parent | c671a36ae0cd655c2efc38ee9882baa8354d660b (diff) |
Add shared constant for PAGE_SIZE.
Diffstat (limited to 'vespalib')
-rw-r--r-- | vespalib/src/tests/datastore/array_store/array_store_test.cpp | 3 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/util/memory_allocator.h | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/vespalib/src/tests/datastore/array_store/array_store_test.cpp b/vespalib/src/tests/datastore/array_store/array_store_test.cpp index d46df668df6..aa35fb24823 100644 --- a/vespalib/src/tests/datastore/array_store/array_store_test.cpp +++ b/vespalib/src/tests/datastore/array_store/array_store_test.cpp @@ -480,7 +480,8 @@ struct ByteStoreTest : public ArrayStoreTest<testing::Test, uint8_t> { ByteStoreTest() : ArrayStoreTest<testing::Test, uint8_t>(ByteStoreTest::ArrayStoreType:: optimizedConfigForHugePage(1023, vespalib::alloc::MemoryAllocator::HUGEPAGE_SIZE, - 4_Ki, 8_Ki, ALLOC_GROW_FACTOR)) {} + vespalib::alloc::MemoryAllocator::PAGE_SIZE, + 8_Ki, ALLOC_GROW_FACTOR)) {} }; TEST_F(ByteStoreTest, offset_in_EntryRefT_is_within_bounds_when_allocating_memory_buffers_where_wanted_number_of_bytes_is_not_a_power_of_2_and_less_than_huge_page_size) diff --git a/vespalib/src/vespa/vespalib/util/memory_allocator.h b/vespalib/src/vespa/vespalib/util/memory_allocator.h index 4f5374b0f11..2bcd7e5889d 100644 --- a/vespalib/src/vespa/vespalib/util/memory_allocator.h +++ b/vespalib/src/vespa/vespalib/util/memory_allocator.h @@ -2,6 +2,7 @@ #pragma once +#include <vespa/vespalib/util/size_literals.h> #include <utility> #include <cstddef> @@ -12,7 +13,8 @@ namespace vespalib::alloc { */ class MemoryAllocator { public: - static constexpr size_t HUGEPAGE_SIZE = 0x200000u; + static constexpr size_t PAGE_SIZE = 4_Ki; + static constexpr size_t HUGEPAGE_SIZE = 2_Mi; using PtrAndSize = std::pair<void *, size_t>; MemoryAllocator(const MemoryAllocator &) = delete; MemoryAllocator & operator = (const MemoryAllocator &) = delete; |