libfoedus-core
FOEDUS Core Library
foedus::memory::GlobalVolatilePageResolver Struct Referencefinal

Resolves an offset in a volatile page pool to an actual pointer and vice versa. More...

Detailed Description

Resolves an offset in a volatile page pool to an actual pointer and vice versa.

This class abstracts how we convert 4-byte page-pool offset plus NUMA node id to/from 8-byte pointer. This method must be VERY efficient, thus everything is inlined. This also abstracts how we access in-memory pages in other NUMA node for volatile pages.

Note Note that this is only for volatile pages. As snapshot cache is per-node, there is no global snapshot page resolver (just the node-local one should be enough).

This object is copiable and the copying is moderately efficient.

Todo:
global page resolve can't cheaply provide resolve_page(). Do we need it?

Definition at line 92 of file page_resolver.hpp.

#include <page_resolver.hpp>

Collaboration diagram for foedus::memory::GlobalVolatilePageResolver:

Public Types

enum  Constants { kMaxNumaNode = 256 }
 
typedef storage::PageBase
 

Public Member Functions

 GlobalVolatilePageResolver ()
 
 GlobalVolatilePageResolver (const Base *bases, uint16_t numa_node_count, PagePoolOffset begin, PagePoolOffset end)
 
 GlobalVolatilePageResolver (const GlobalVolatilePageResolver &other)
 
GlobalVolatilePageResolveroperator= (const GlobalVolatilePageResolver &other)
 
storage::Pageresolve_offset (uint8_t numa_node, PagePoolOffset offset) const __attribute__((always_inline))
 Resolves offset plus NUMA node ID to storage::Page*. More...
 
storage::Pageresolve_offset (storage::VolatilePagePointer page_pointer) const __attribute__((always_inline))
 Resolves volatile page ID to storage::Page*. More...
 
storage::Pageresolve_offset_newpage (uint8_t numa_node, PagePoolOffset offset) const __attribute__((always_inline))
 As the name suggests, this version is for new pages, which don't have sanity checks. More...
 
storage::Pageresolve_offset_newpage (storage::VolatilePagePointer page_pointer) const __attribute__((always_inline))
 As the name suggests, this version is for new pages, which don't have sanity checks. More...
 

Public Attributes

uint16_t numa_node_count_
 number of NUMA nodes in this engine. More...
 
PagePoolOffset begin_
 where a valid page entry starts. More...
 
PagePoolOffset end_
 where a valid page entry ends. More...
 
Base bases_ [kMaxNumaNode]
 base address to calculate from/to offset. More...
 

Member Typedef Documentation

Member Enumeration Documentation

Constructor & Destructor Documentation

foedus::memory::GlobalVolatilePageResolver::GlobalVolatilePageResolver ( )
inline

Definition at line 97 of file page_resolver.hpp.

97 : numa_node_count_(0), begin_(0), end_(0) {}
uint16_t numa_node_count_
number of NUMA nodes in this engine.
PagePoolOffset begin_
where a valid page entry starts.
PagePoolOffset end_
where a valid page entry ends.
foedus::memory::GlobalVolatilePageResolver::GlobalVolatilePageResolver ( const Base bases,
uint16_t  numa_node_count,
PagePoolOffset  begin,
PagePoolOffset  end 
)
inline

Definition at line 98 of file page_resolver.hpp.

References ASSERT_ND, bases_, kMaxNumaNode, and numa_node_count_.

100  : numa_node_count_(numa_node_count), begin_(begin), end_(end) {
101  ASSERT_ND(numa_node_count <= kMaxNumaNode);
102  std::memcpy(bases_, bases, sizeof(Base) * numa_node_count_);
103  }
uint16_t numa_node_count_
number of NUMA nodes in this engine.
PagePoolOffset begin_
where a valid page entry starts.
PagePoolOffset end_
where a valid page entry ends.
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
Definition: assert_nd.hpp:72
Base bases_[kMaxNumaNode]
base address to calculate from/to offset.
foedus::memory::GlobalVolatilePageResolver::GlobalVolatilePageResolver ( const GlobalVolatilePageResolver other)
inline

Definition at line 105 of file page_resolver.hpp.

References operator=().

105  {
106  operator=(other);
107  }
GlobalVolatilePageResolver & operator=(const GlobalVolatilePageResolver &other)

Here is the call graph for this function:

Member Function Documentation

GlobalVolatilePageResolver& foedus::memory::GlobalVolatilePageResolver::operator= ( const GlobalVolatilePageResolver other)
inline

Definition at line 108 of file page_resolver.hpp.

References ASSERT_ND, bases_, begin_, end_, kMaxNumaNode, and numa_node_count_.

Referenced by GlobalVolatilePageResolver().

108  {
109  ASSERT_ND(other.numa_node_count_ > 0);
110  ASSERT_ND(other.numa_node_count_ <= kMaxNumaNode);
111  ASSERT_ND(other.end_ > other.begin_);
112  numa_node_count_ = other.numa_node_count_;
113  begin_ = other.begin_;
114  end_ = other.end_;
115  std::memcpy(bases_, other.bases_, sizeof(Base) * numa_node_count_);
116  return *this;
117  }
uint16_t numa_node_count_
number of NUMA nodes in this engine.
PagePoolOffset begin_
where a valid page entry starts.
PagePoolOffset end_
where a valid page entry ends.
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
Definition: assert_nd.hpp:72
Base bases_[kMaxNumaNode]
base address to calculate from/to offset.

Here is the caller graph for this function:

storage::Page* foedus::memory::GlobalVolatilePageResolver::resolve_offset ( uint8_t  numa_node,
PagePoolOffset  offset 
) const
inline

Resolves offset plus NUMA node ID to storage::Page*.

Definition at line 120 of file page_resolver.hpp.

References ASSERT_ND, foedus::storage::assert_valid_volatile_page(), foedus::storage::construct_volatile_page_pointer(), foedus::storage::Page::get_header(), foedus::storage::PageHeader::page_id_, and resolve_offset_newpage().

Referenced by foedus::storage::assert_within_valid_volatile_page_impl(), foedus::storage::hash::HashStoragePimpl::debugout_single_thread(), foedus::storage::masstree::MasstreeStoragePimpl::debugout_single_thread_follow(), foedus::storage::array::ArrayPartitioner::design_partition(), foedus::storage::masstree::MasstreePartitioner::design_partition(), foedus::storage::masstree::design_partition_first_parallel(), foedus::storage::masstree::design_partition_first_parallel_recurse(), foedus::storage::hash::HashPartitioner::design_partition_task(), foedus::storage::masstree::MasstreeStoragePimpl::drop(), foedus::storage::hash::HashStoragePimpl::drop(), foedus::storage::Composer::DropVolatilesArguments::drop(), foedus::thread::ThreadPimpl::follow_page_pointer(), foedus::thread::ThreadPimpl::follow_page_pointers_for_read_batch(), foedus::thread::ThreadPimpl::follow_page_pointers_for_write_batch(), foedus::storage::masstree::MasstreeStoragePimpl::hcc_reset_all_temperature_stat_follow(), foedus::thread::ThreadPimpl::is_volatile_page_retired(), foedus::storage::masstree::MasstreeStoragePimpl::peek_volatile_page_boundaries(), foedus::storage::masstree::MasstreeStoragePimpl::peek_volatile_page_boundaries_next_layer(), foedus::storage::masstree::MasstreeStoragePimpl::peek_volatile_page_boundaries_this_layer_recurse(), foedus::thread::ThreadPimpl::place_a_new_volatile_page(), foedus::storage::hash::HashIntermediatePage::release_pages_recursive(), foedus::storage::hash::HashDataPage::release_pages_recursive(), foedus::storage::array::ArrayStoragePimpl::release_pages_recursive(), foedus::storage::masstree::MasstreeIntermediatePage::release_pages_recursive(), foedus::storage::masstree::MasstreeBorderPage::release_pages_recursive(), foedus::storage::masstree::release_parallel(), foedus::storage::hash::release_parallel(), foedus::thread::Thread::resolve(), foedus::storage::hash::resolve_data_impl(), foedus::storage::hash::resolve_intermediate_impl(), resolve_offset(), foedus::storage::masstree::MasstreeBorderPage::track_moved_record_next_layer(), foedus::storage::hash::HashStoragePimpl::track_moved_record_search(), foedus::storage::array::ArrayStoragePimpl::verify_single_thread(), and foedus::storage::hash::HashStoragePimpl::verify_single_thread().

120  {
121  storage::Page* page = resolve_offset_newpage(numa_node, offset);
122  // this is NOT a new page, so we have sanity checks
124  ASSERT_ND(storage::construct_volatile_page_pointer(page->get_header().page_id_).get_numa_node()
125  == numa_node);
126  return page;
127  }
void assert_valid_volatile_page(const Page *page, uint32_t offset)
Definition: page.hpp:407
storage::Page * resolve_offset_newpage(uint8_t numa_node, PagePoolOffset offset) const __attribute__((always_inline))
As the name suggests, this version is for new pages, which don't have sanity checks.
VolatilePagePointer construct_volatile_page_pointer(uint64_t word)
Definition: storage_id.hpp:230
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
Definition: assert_nd.hpp:72

Here is the call graph for this function:

Here is the caller graph for this function:

storage::Page* foedus::memory::GlobalVolatilePageResolver::resolve_offset ( storage::VolatilePagePointer  page_pointer) const
inline

Resolves volatile page ID to storage::Page*.

Definition at line 129 of file page_resolver.hpp.

References resolve_offset().

129  {
130  return resolve_offset(page_pointer.get_numa_node(), page_pointer.get_offset());
131  }
storage::Page * resolve_offset(uint8_t numa_node, PagePoolOffset offset) const __attribute__((always_inline))
Resolves offset plus NUMA node ID to storage::Page*.

Here is the call graph for this function:

storage::Page* foedus::memory::GlobalVolatilePageResolver::resolve_offset_newpage ( uint8_t  numa_node,
PagePoolOffset  offset 
) const
inline

As the name suggests, this version is for new pages, which don't have sanity checks.

Definition at line 134 of file page_resolver.hpp.

References foedus::storage::assert_aligned_page(), ASSERT_ND, bases_, begin_, end_, and numa_node_count_.

Referenced by foedus::storage::sequential::SequentialStoragePimpl::get_head_pointer(), foedus::storage::sequential::SequentialStoragePimpl::get_tail_pointer(), foedus::thread::Thread::resolve_newpage(), resolve_offset(), and resolve_offset_newpage().

136  {
137  ASSERT_ND(numa_node < numa_node_count_);
138  ASSERT_ND(offset >= begin_);
139  ASSERT_ND(offset < end_);
140  storage::assert_aligned_page(bases_[numa_node] + offset);
141  return bases_[numa_node] + offset;
142  }
void assert_aligned_page(const void *page)
Definition: page.hpp:402
uint16_t numa_node_count_
number of NUMA nodes in this engine.
PagePoolOffset begin_
where a valid page entry starts.
PagePoolOffset end_
where a valid page entry ends.
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
Definition: assert_nd.hpp:72
Base bases_[kMaxNumaNode]
base address to calculate from/to offset.

Here is the call graph for this function:

Here is the caller graph for this function:

storage::Page* foedus::memory::GlobalVolatilePageResolver::resolve_offset_newpage ( storage::VolatilePagePointer  page_pointer) const
inline

As the name suggests, this version is for new pages, which don't have sanity checks.

Definition at line 144 of file page_resolver.hpp.

References resolve_offset_newpage().

145  {
146  return resolve_offset_newpage(
147  page_pointer.get_numa_node(),
148  page_pointer.get_offset());
149  }
storage::Page * resolve_offset_newpage(uint8_t numa_node, PagePoolOffset offset) const __attribute__((always_inline))
As the name suggests, this version is for new pages, which don't have sanity checks.

Here is the call graph for this function:

Member Data Documentation

Base foedus::memory::GlobalVolatilePageResolver::bases_[kMaxNumaNode]

base address to calculate from/to offset.

index is NUMA node ID.

Definition at line 159 of file page_resolver.hpp.

Referenced by foedus::xct::from_universal_lock_id(), GlobalVolatilePageResolver(), foedus::xct::McsMockContext< RW_BLOCK >::init(), operator=(), and resolve_offset_newpage().


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