libfoedus-core
FOEDUS Core Library
foedus::memory::PageReleaseBatch Class Referencefinal

A helper class to return a bunch of pages to individual nodes. More...

Detailed Description

A helper class to return a bunch of pages to individual nodes.

This returns a large number of pages much more efficiently than returning one-by-one, especially if the in-memory pages might come from different NUMA nodes. So far this is used when we shutdown the engine or drop a storage.

Definition at line 276 of file page_pool.hpp.

#include <page_pool.hpp>

Public Types

typedef PagePoolOffsetChunkChunkPtr
 

Public Member Functions

 PageReleaseBatch (Engine *engine)
 
 ~PageReleaseBatch ()
 
 PageReleaseBatch ()=delete
 
 PageReleaseBatch (const PageReleaseBatch &)=delete
 
PageReleaseBatchoperator= (const PageReleaseBatch &)=delete
 
void release (storage::VolatilePagePointer page_id)
 Returns the given in-memory volatile page to appropriate NUMA node. More...
 
void release (thread::ThreadGroupId numa_node, PagePoolOffset offset)
 Returns the given in-memory page to the specified NUMA node. More...
 
void release_chunk (thread::ThreadGroupId numa_node)
 Return all batched pages in the given chunk to its pool. More...
 
void release_all ()
 Called at the end to return all batched pages to their pools. More...
 

Member Typedef Documentation

Constructor & Destructor Documentation

foedus::memory::PageReleaseBatch::PageReleaseBatch ( Engine engine)
explicit

Definition at line 153 of file page_pool.cpp.

154  : engine_(engine), numa_node_count_(engine->get_options().thread_.group_count_) {
155  std::memset(chunks_, 0, sizeof(ChunkPtr) * 256);
156  for (thread::ThreadGroupId i = 0; i < numa_node_count_; ++i) {
157  chunks_[i] = new PagePoolOffsetChunk;
158  }
159 }
PagePoolOffsetChunk * ChunkPtr
Definition: page_pool.hpp:278
uint8_t ThreadGroupId
Typedef for an ID of ThreadGroup (NUMA node).
Definition: thread_id.hpp:38
foedus::memory::PageReleaseBatch::~PageReleaseBatch ( )

Definition at line 161 of file page_pool.cpp.

References release_all().

161  {
162  release_all();
163  for (thread::ThreadGroupId i = 0; i < numa_node_count_; ++i) {
164  delete chunks_[i];
165  chunks_[i] = nullptr;
166  }
167 }
void release_all()
Called at the end to return all batched pages to their pools.
Definition: page_pool.cpp:189
uint8_t ThreadGroupId
Typedef for an ID of ThreadGroup (NUMA node).
Definition: thread_id.hpp:38

Here is the call graph for this function:

foedus::memory::PageReleaseBatch::PageReleaseBatch ( )
delete
foedus::memory::PageReleaseBatch::PageReleaseBatch ( const PageReleaseBatch )
delete

Member Function Documentation

PageReleaseBatch& foedus::memory::PageReleaseBatch::operator= ( const PageReleaseBatch )
delete
void foedus::memory::PageReleaseBatch::release ( storage::VolatilePagePointer  page_id)
inline

Returns the given in-memory volatile page to appropriate NUMA node.

This internally batches the pages to return. At the end, call release_all() to flush it.

Definition at line 292 of file page_pool.hpp.

Referenced by 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(), and foedus::storage::masstree::MasstreeBorderPage::release_pages_recursive().

292  {
293  release(page_id.get_numa_node(), page_id.get_offset());
294  }
void release(storage::VolatilePagePointer page_id)
Returns the given in-memory volatile page to appropriate NUMA node.
Definition: page_pool.hpp:292

Here is the caller graph for this function:

void foedus::memory::PageReleaseBatch::release ( thread::ThreadGroupId  numa_node,
PagePoolOffset  offset 
)

Returns the given in-memory page to the specified NUMA node.

This internally batches the pages to return. At the end, call release_all() to flush it.

Definition at line 169 of file page_pool.cpp.

References ASSERT_ND, foedus::memory::PagePoolOffsetChunk::push_back(), and release_chunk().

169  {
170  ASSERT_ND(numa_node < numa_node_count_);
171  if (chunks_[numa_node]->full()) {
172  release_chunk(numa_node);
173  }
174  ASSERT_ND(!chunks_[numa_node]->full());
175  chunks_[numa_node]->push_back(offset);
176 }
void release_chunk(thread::ThreadGroupId numa_node)
Return all batched pages in the given chunk to its pool.
Definition: page_pool.cpp:178
void push_back(PagePoolOffset pointer)
Definition: page_pool.hpp:68
#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:

void foedus::memory::PageReleaseBatch::release_all ( )

Called at the end to return all batched pages to their pools.

Definition at line 189 of file page_pool.cpp.

References release_chunk().

Referenced by foedus::storage::array::ArrayStorage::drop(), foedus::storage::hash::HashIntermediatePage::release_pages_recursive_parallel(), foedus::storage::masstree::release_parallel(), and ~PageReleaseBatch().

189  {
190  for (thread::ThreadGroupId i = 0; i < numa_node_count_; ++i) {
191  release_chunk(i);
192  }
193 }
void release_chunk(thread::ThreadGroupId numa_node)
Return all batched pages in the given chunk to its pool.
Definition: page_pool.cpp:178
uint8_t ThreadGroupId
Typedef for an ID of ThreadGroup (NUMA node).
Definition: thread_id.hpp:38

Here is the call graph for this function:

Here is the caller graph for this function:

void foedus::memory::PageReleaseBatch::release_chunk ( thread::ThreadGroupId  numa_node)

Return all batched pages in the given chunk to its pool.

Definition at line 178 of file page_pool.cpp.

References ASSERT_ND, foedus::Engine::get_memory_manager(), foedus::memory::EngineMemory::get_node_memory(), foedus::memory::NumaNodeMemoryRef::get_volatile_pool(), and foedus::memory::PagePool::release().

Referenced by release(), and release_all().

178  {
179  ASSERT_ND(numa_node < numa_node_count_);
180  if (chunks_[numa_node]->empty()) {
181  return;
182  }
183 
184  engine_->get_memory_manager()->get_node_memory(numa_node)->get_volatile_pool()->release(
185  chunks_[numa_node]->size(), chunks_[numa_node]);
186  ASSERT_ND(chunks_[numa_node]->empty());
187 }
NumaNodeMemoryRef * get_node_memory(foedus::thread::ThreadGroupId group) const
void release(uint32_t desired_release_count, PagePoolOffsetChunk *chunk)
Returns the specified number of free pages from the chunk.
Definition: page_pool.cpp:134
#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
memory::EngineMemory * get_memory_manager() const
See Memory Manager.
Definition: engine.cpp:50

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files: