libfoedus-core
FOEDUS Core Library
memory_options.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2015, Hewlett-Packard Development Company, LP.
3  * This program is free software; you can redistribute it and/or modify it
4  * under the terms of the GNU General Public License as published by the Free
5  * Software Foundation; either version 2 of the License, or (at your option)
6  * any later version.
7  *
8  * This program is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11  * more details. You should have received a copy of the GNU General Public
12  * License along with this program; if not, write to the Free Software
13  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14  *
15  * HP designates this particular file as subject to the "Classpath" exception
16  * as provided by HP in the LICENSE.txt file that accompanied this code.
17  */
19 
22 
23 namespace foedus {
24 namespace memory {
27  use_numa_alloc_ = true;
28  interleave_numa_alloc_ = false;
29  use_mmap_hugepages_ = false;
34 }
35 
36 ErrorStack MemoryOptions::load(tinyxml2::XMLElement* element) {
45  return kRetOk;
46 }
47 
48 ErrorStack MemoryOptions::save(tinyxml2::XMLElement* element) const {
49  CHECK_ERROR(insert_comment(element, "Set of options for memory manager"));
50 
52  "Whether to tolerate insufficient hugepages etc in the prescreen check.");
54  "Whether to use ::numa_alloc_interleaved()/::numa_alloc_onnode() to allocate memories"
55  " in NumaCoreMemory and NumaNodeMemory.\n"
56  " If false, we use usual posix_memalign() instead.\n"
57  " If everything works correctly, ::numa_alloc_interleaved()/::numa_alloc_onnode()\n"
58  " should result in much better performance because each thread should access only\n"
59  " the memories allocated for the NUMA node. Default is true..");
61  "Whether to use ::numa_alloc_interleaved() instead of ::numa_alloc_onnode()\n"
62  " If everything works correctly, numa_alloc_onnode() should result in much better\n"
63  " performance because interleaving just wastes memory if it is very rare to access other\n"
64  " node's memory. Default is false.\n"
65  " If use_numa_alloc_ is false, this configuration has no meaning.");
67  "Whether to use non-transparent hugepages for big memories (1GB huge pages)\n"
68  " To use this, you have to set up non-transparent hugepages that requires a reboot.\n"
69  " See the readme fore more details.");
71  "Whether to use mprotect() for memory boundaries to detect bogus memory accesses.");
73  "Whether to use mprotect() for page boundaries to detect bogus memory accesses.");
75  "Size of the page pool in MB per each NUMA node. Must be multiply of 2MB.");
77  "How many pages each NumaCoreMemory initially grabs when it is initialized."
78  " Default is 50% of PagePoolOffsetChunk::kMaxSize\n"
79  " Obviously, private_page_pool_initial_grab_ * kPageSize * number-of-threads must be"
80  " within page_pool_size_mb_per_node_ to start up the engine.");
81  return kRetOk;
82 }
83 
84 } // namespace memory
85 } // namespace foedus
#define EXTERNALIZE_LOAD_ELEMENT(element, attribute)
Reads a child xml element to load a member variable of this object.
MemoryOptions()
Constructs option values with default values.
uint32_t private_page_pool_initial_grab_
How many pages each NumaCoreMemory initially grabs when it is initialized.
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
Definition: assert_nd.hpp:44
Brings error stacktrace information as return value of functions.
Definition: error_stack.hpp:81
static ErrorStack insert_comment(tinyxml2::XMLElement *element, const std::string &comment)
Max number of pointers to pack.
Definition: page_pool.hpp:54
bool rigorous_memory_boundary_check_
Whether to use mprotect() for memory boundaries to detect bogus memory accesses.
ErrorStack save(tinyxml2::XMLElement *element) const override
Writes the content of this object to the given XML element.
bool use_mmap_hugepages_
Whether to use non-transparent hugepages for big memories (1GB huge pages).
ErrorStack load(tinyxml2::XMLElement *element) override
Reads the content of this object from the given XML element.
#define CHECK_ERROR(x)
This macro calls x and checks its returned value.
uint32_t page_pool_size_mb_per_node_
Size of the page pool in MB per each NUMA node.
bool interleave_numa_alloc_
Whether to use numa_alloc_interleaved() instead of numa_alloc_onnode().
const ErrorStack kRetOk
Normal return value for no-error case.
Default value for page_pool_size_mb_per_node_.
bool suppress_memory_prescreening_
Whether to tolerate insufficient hugepages etc in the prescreen check.
#define EXTERNALIZE_SAVE_ELEMENT(element, attribute, comment)
Adds an xml element to represent a member variable of this object.
bool rigorous_page_boundary_check_
Whether to use mprotect() for page boundaries to detect bogus memory accesses.
bool use_numa_alloc_
Whether to use numa_alloc_interleaved()/numa_alloc_onnode() to allocate memories in NumaCoreMemory an...