18 #ifndef FOEDUS_MEMORY_PAGE_POOL_PIMPL_HPP_
19 #define FOEDUS_MEMORY_PAGE_POOL_PIMPL_HPP_
82 bool rigorous_page_boundary_check);
88 template <
typename CHUNK>
89 void release_impl(uint32_t desired_release_count, CHUNK* chunk);
112 for (uint64_t i = 0; i < free_count; ++i) {
113 uint64_t index = free_head + i;
132 return "Not-attached";
187 "PagePoolControlBlock is too large.");
190 #endif // FOEDUS_MEMORY_PAGE_POOL_PIMPL_HPP_
void attach(PagePoolControlBlock *control_block, void *memory, uint64_t memory_size, bool owns, bool rigorous_page_boundary_check)
void increase_free_pool_count(uint64_t op)
uint64_t free_pool_head() const
std::string get_debug_pool_name() const
bool rigorous_page_boundary_check_
Whether to use mprotect() for page boundaries to detect bogus memory accesses.
void * memory_
The whole memory region of the pool.
uint64_t get_free_pool_count() const
void initialize(bool recursive=false)
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
uint32_t PagePoolOffset
Offset in PagePool that compactly represents the page address (unlike 8 bytes pointer).
Typedefs of ID types used in thread package.
~PagePoolControlBlock()=delete
void set_debug_pool_name(const std::string &name)
Forward declarations of classes in root package.
friend std::ostream & operator<<(std::ostream &o, const PagePoolPimpl &v)
storage::Page * pool_base_
Just an auxiliary variable to the beginning of the pool.
Brings error stacktrace information as return value of functions.
uint64_t free_pool_capacity_
Size of free_pool_.
Typical implementation of Initializable as a skeleton base class.
void release_one(PagePoolOffset offset)
uint64_t & free_pool_head()
soc::SharedMutex lock_
grab()/release() are protected with this lock.
PagePoolControlBlock * control_block_
ErrorCode grab(uint32_t desired_grab_count, PagePoolOffsetChunk *chunk)
A mutex that can be placed in shared memory and used from multiple processes.
uint64_t pool_size_
Just an auxiliary variable of the size of pool.
PagePool::Stat get_stat() const
void release_impl(uint32_t desired_release_count, CHUNK *chunk)
void assign(const FixedString< MAXLEN2, CHAR > &other) noexcept
Assign operator for all FixedString objects.
ErrorStack initialize_once() override
void decrease_free_pool_count(uint64_t op)
void assert_free_pool() const
Not thread safe.
Pimpl object of PagePool.
bool empty() const noexcept
Test if string is empty.
void release(uint32_t desired_release_count, PagePoolOffsetChunk *chunk)
ErrorStack uninitialize_once() override
std::basic_string< CHAR > str() const
Convert to a std::string object.
Just a marker to denote that the memory region represents a data page.
uint64_t free_pool_head_
Inclusive head of the circular queue.
ErrorCode grab_one(PagePoolOffset *offset)
bool owns_
Whether this engine owns this page pool.
LocalPageResolver resolver_
An object to resolve an offset in this page pool (thus local) to an actual pointer and vice versa...
Used to point to an already existing array.
uint64_t free_pool_count_
Number of free pages.
PagePoolControlBlock()=delete
Shared data in PagePoolPimpl.
assorted::FixedString< 60 > debug_pool_name_
just for debugging/logging.
const LocalPageResolver & get_resolver() const
To reduce the overhead of grabbing/releasing pages from pool, we pack this many pointers for each gra...
uint64_t pages_for_free_pool_
This many first pages are used for free page maintainance.
Used to store an epoch value with each entry in PagePoolOffsetChunk.
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
uint64_t get_free_pool_capacity() const
ErrorCode
Enum of error codes defined in error_code.xmacro.
uint64_t memory_size_
Byte size of this page pool.
PagePoolOffset * free_pool_
We maintain free pages as a simple circular queue.