21 #include <glog/logging.h>
44 LOG(INFO) <<
"Initializing EngineMemory..";
48 LOG(WARNING) <<
"WARNING, this machine is not a NUMA machine. FOEDUS still works fine,"
49 <<
" but it is mainly designed for large servers with many sockets and cores";
58 uint64_t pool_begin = 0, pool_end = 0;
61 node_memories_.push_back(ref);
77 LOG(INFO) <<
"Node memory-" << node <<
" was initialized!";
79 if (options.memory_.rigorous_memory_boundary_check_) {
80 LOG(WARNING) <<
"CAUTION: memory_.rigorous_memory_boundary_check_ is ON. We will"
81 <<
" put mprotect-ed pages between memory regions for debugging. It will be SLOW!";
83 if (options.memory_.rigorous_page_boundary_check_) {
84 LOG(WARNING) <<
"CAUTION: memory_.rigorous_page_boundary_check_ is ON. We will"
85 <<
" put mprotect-ed pages between every single page for debugging. It will be SLOOOW!";
92 LOG(INFO) <<
"Uninitializing EngineMemory..";
97 for (
auto* ref : node_memories_) {
100 node_memories_.clear();
103 if (!engine_->
is_master() && local_memory_) {
106 delete local_memory_;
107 local_memory_ =
nullptr;
108 LOG(INFO) <<
"Node memory-" << node <<
" was uninitialized!";
122 std::stringstream ret;
123 ret <<
" == Free memory stat ==" << std::endl;
127 ret <<
" - Node_" <<
static_cast<int>(node) <<
" -" << std::endl;
129 if (node + 1U < numa_nodes) {
144 pointer->
set(node, offset);
157 (*page)->get_header().snapshot_ =
false;
158 (*page)->get_header().page_id_ = pointer->
word;
ErrorStack uninitialize_once() override
std::string dump_free_memory_stat() const
Report rough statistics of free memory.
Definitions of IDs in this package and a few related constant values.
ErrorCode read_page(storage::SnapshotPagePointer page_id, void *out)
void emprace_back(ErrorStack &&error_stack)
If the given ErrorStack is an error, this method adds it to the end of this batch.
#define ERROR_STACK(e)
Instantiates ErrorStack with the given foedus::error_code, creating an error stack with the current f...
Page pool for volatile read/write store (VolatilePage) and the read-only bufferpool (SnapshotPage)...
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
ErrorCode grab_one(PagePoolOffset *offset)
Grab only one page.
uint32_t PagePoolOffset
Offset in PagePool that compactly represents the page address (unlike 8 bytes pointer).
Typedefs of ID types used in thread package.
0x0005 : "GENERAL: A dependent module is not initialized yet. This implies a wrong initialization ord...
Represents a pointer to a volatile page with modification count for preventing ABA.
ErrorStack load_one_volatile_page(cache::SnapshotFileSet *fileset, storage::SnapshotPagePointer snapshot_pointer, storage::VolatilePagePointer *pointer, storage::Page **page)
Another convenience method that also reads an existing snapshot page to the volatile page...
ErrorStack uninitialize() override final
Typical implementation of Initializable::uninitialize() that provides uninitialize-once semantics...
Brings error stacktrace information as return value of functions.
Holds a set of read-only file objects for snapshot files.
ErrorStack initialize_once() override
void * get_shared_user_memory() const
As part of the global shared memory, we reserve this size of 'user memory' that can be used for arbit...
const EngineOptions & get_options() const
bool is_master() const
Returns if this engine object is a master instance.
A view of NumaNodeMemory for other SOCs and master engine.
Batches zero or more ErrorStack objects to represent in one ErrorStack.
storage::Page * get_base() const
uint64_t get_shared_user_memory_size() const
void * get_shared_user_memory() const
Shortcut for get_shared_memory_repo()->get_global_user_memory()
uint64_t SnapshotPagePointer
Page ID of a snapshot page.
ErrorStack initialize() override final
Typical implementation of Initializable::initialize() that provides initialize-once semantics...
Repository of memories dynamically acquired and shared within one NUMA node (socket).
NumaNodeMemoryRef * get_node_memory(foedus::thread::ThreadGroupId group) const
Just a marker to denote that the memory region represents a data page.
void set(uint8_t numa_node, memory::PagePoolOffset offset)
Set of option values given to the engine at start-up.
ErrorStack grab_one_volatile_page(foedus::thread::ThreadGroupId node, storage::VolatilePagePointer *pointer, storage::Page **page)
A convenience function to grab one free volatile page from the given node.
uint8_t extract_numa_node_from_snapshot_pointer(SnapshotPagePointer pointer)
uint16_t group_count_
Number of ThreadGroup in the engine.
uint64_t get_shared_user_memory_size() const
#define SUMMARIZE_ERROR_BATCH(x)
This macro calls ErrorStackBatch::summarize() with automatically provided parameters.
std::string dump_free_memory_stat() const
Report rough statistics of free memory.
uint16_t SocId
Represents an ID of an SOC, or NUMA node.
thread::ThreadOptions thread_
#define CHECK_ERROR(x)
This macro calls x and checks its returned value.
const ErrorStack kRetOk
Normal return value for no-error case.
soc::SocManager * get_soc_manager() const
See SOC and IPC.
PagePool * get_volatile_pool()
soc::SocId get_soc_id() const
If this is a child instance, returns its SOC ID (NUMA node).
const LocalPageResolver & get_resolver() const
Gives an object to resolve an offset in this page pool (thus local) to an actual pointer and vice ver...
debugging::DebuggingSupports * get_debug() const
See Debug-Support functionalities.
0x0006 : "GENERAL: A dependent module is already uninitialized. This implies a wrong uninitialization...
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
#define WRAP_ERROR_CODE(x)
Same as CHECK_ERROR(x) except it receives only an error code, thus more efficient.
uint8_t ThreadGroupId
Typedef for an ID of ThreadGroup (NUMA node).
bool is_initialized() const override final
Returns whether the object has been already initialized or not.