libfoedus-core
FOEDUS Core Library
foedus::memory::ScopedNumaPreferred Struct Reference

Automatically sets and resets numa_set_preferred(). More...

Detailed Description

Automatically sets and resets numa_set_preferred().

Use this in a place you want to direct all memory allocation to a specific NUMA node.

Definition at line 58 of file memory_id.hpp.

#include <memory_id.hpp>

Public Member Functions

 ScopedNumaPreferred (int numa_node, bool retain_old=false)
 
 ~ScopedNumaPreferred ()
 

Public Attributes

int old_value_
 
bool numa_enabled_
 

Constructor & Destructor Documentation

foedus::memory::ScopedNumaPreferred::ScopedNumaPreferred ( int  numa_node,
bool  retain_old = false 
)
inline

Definition at line 59 of file memory_id.hpp.

References foedus::assorted::mod_numa_node(), numa_available(), numa_enabled_, numa_preferred(), numa_set_preferred(), and old_value_.

59  {
60  // if the machine is not a NUMA machine (1-socket), then avoid calling libnuma functions.
62  if (!numa_enabled_) {
63  numa_node = 0;
64  return;
65  }
66  if (retain_old) {
68  } else {
69  old_value_ = -1;
70  }
71  // in order to run even on a non-numa machine or a machine with fewer sockets,
72  // we allow specifying arbitrary numa_node. we just take rem.
73  numa_node = assorted::mod_numa_node(numa_node);
74  ::numa_set_preferred(numa_node);
75  }
int numa_available(void)
int numa_preferred(void)
int mod_numa_node(int numa_node)
In order to run even on a non-numa machine or a machine with fewer sockets, we allow specifying arbit...
void numa_set_preferred(int node)

Here is the call graph for this function:

foedus::memory::ScopedNumaPreferred::~ScopedNumaPreferred ( )
inline

Definition at line 76 of file memory_id.hpp.

References numa_enabled_, numa_set_preferred(), and old_value_.

76  {
77  if (numa_enabled_) {
79  }
80  }
void numa_set_preferred(int node)

Here is the call graph for this function:

Member Data Documentation

bool foedus::memory::ScopedNumaPreferred::numa_enabled_

Definition at line 82 of file memory_id.hpp.

Referenced by ScopedNumaPreferred(), and ~ScopedNumaPreferred().

int foedus::memory::ScopedNumaPreferred::old_value_

Definition at line 81 of file memory_id.hpp.

Referenced by ScopedNumaPreferred(), and ~ScopedNumaPreferred().


The documentation for this struct was generated from the following file: