ROOT  6.06/09
Reference Guide
Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
BidirMMapPipe_impl::PageChunk Class Reference

class representing a chunk of pages

Author
Manuel Schiller manue.nosp@m.l.sc.nosp@m.hille.nosp@m.r@ni.nosp@m.khef..nosp@m.nl
Date
2013-07-24

allocating pages from the OS happens in chunks in order to not exhaust the maximum allowed number of memory mappings per process; this class takes care of such a chunk

a page chunk allows callers to obtain or release pages in groups of continuous pages of fixed size

Definition at line 44 of file BidirMMapPipe.h.

Public Types

enum  MMapVariety {
  Unknown, Copy, FileBacked, DevZero,
  Anonymous
}
 type of mmap support found More...
 

Public Member Functions

 PageChunk (PagePool *parent, unsigned length, unsigned nPgPerGroup)
 constructor More...
 
 ~PageChunk ()
 destructor More...
 
bool contains (const Pages &p) const
 return if p is contained in this PageChunk More...
 
Pages pop ()
 pop a group of pages off the free list More...
 
void push (const Pages &p)
 push a group of pages onto the free list More...
 
unsigned len () const
 return length of chunk More...
 
unsigned nPagesPerGroup () const
 return number of pages per page group More...
 
bool empty () const
 return true if no used page groups in this chunk More...
 
bool full () const
 return true if no free page groups in this chunk More...
 
void zap (Pages &p)
 free all pages except for those pointed to by p More...
 

Static Public Member Functions

static unsigned pagesize ()
 return the page size of the system More...
 
static MMapVariety mmapVariety ()
 return mmap variety support found More...
 

Private Types

typedef BidirMMapPipeException Exception
 convenience typedef More...
 

Private Member Functions

 PageChunk (const PageChunk &)
 forbid copying More...
 
PageChunkoperator= (const PageChunk &)
 forbid assignment More...
 

Static Private Member Functions

static unsigned getPageSize ()
 determine page size at run time More...
 
static voiddommap (unsigned len)
 mmap pages, len is length of mmapped area in bytes More...
 
static void domunmap (void *p, unsigned len)
 munmap pages p, len is length of mmapped area in bytes More...
 

Private Attributes

voidm_begin
 pointer to start of mmapped area More...
 
voidm_end
 pointer one behind end of mmapped area More...
 
std::list< void * > m_freelist
 free pages list More...
 
PagePool * m_parent
 parent page pool More...
 
unsigned m_nPgPerGrp
 number of pages per group More...
 
unsigned m_nUsedGrp
 number of used page groups More...
 

Static Private Attributes

static unsigned s_pagesize = PageChunk::getPageSize()
 system page size (run-time determined) More...
 
static MMapVariety s_mmapworks = PageChunk::Unknown
 mmap variety that works on this system More...
 

#include </mnt/vdb/lsf/workspace/root-makedoc-v606/rootspi/rdoc/src/v6-06-00-patches/roofit/roofitcore/src/BidirMMapPipe.h>

+ Collaboration diagram for BidirMMapPipe_impl::PageChunk:

Member Typedef Documentation

typedef BidirMMapPipeException BidirMMapPipe_impl::PageChunk::Exception
private

convenience typedef

Definition at line 61 of file BidirMMapPipe.h.

Member Enumeration Documentation

type of mmap support found

Enumerator
Unknown 

don't know yet what'll work

Copy 

mmap doesn't work, have to copy back and forth

FileBacked 

mmapping a temp file works

DevZero 

mmapping /dev/zero works

Anonymous 

anonymous mmap works

Definition at line 47 of file BidirMMapPipe.h.

Constructor & Destructor Documentation

BidirMMapPipe_impl::PageChunk::PageChunk ( const PageChunk )
inlineprivate

forbid copying

Definition at line 80 of file BidirMMapPipe.h.

BidirMMapPipe_impl::PageChunk::PageChunk ( PagePool *  parent,
unsigned  length,
unsigned  nPgPerGroup 
)

constructor

Definition at line 339 of file BidirMMapPipe.cxx.

BidirMMapPipe_impl::PageChunk::~PageChunk ( )

destructor

Definition at line 355 of file BidirMMapPipe.cxx.

Member Function Documentation

bool BidirMMapPipe_impl::PageChunk::contains ( const Pages p) const

return if p is contained in this PageChunk

Definition at line 361 of file BidirMMapPipe.cxx.

Referenced by push().

void * BidirMMapPipe_impl::PageChunk::dommap ( unsigned  len)
staticprivate

mmap pages, len is length of mmapped area in bytes

Definition at line 387 of file BidirMMapPipe.cxx.

void BidirMMapPipe_impl::PageChunk::domunmap ( void p,
unsigned  len 
)
staticprivate

munmap pages p, len is length of mmapped area in bytes

Definition at line 527 of file BidirMMapPipe.cxx.

Referenced by ~PageChunk().

bool BidirMMapPipe_impl::PageChunk::empty ( ) const
inline

return true if no used page groups in this chunk

Definition at line 114 of file BidirMMapPipe.h.

Referenced by push(), and ~PageChunk().

bool BidirMMapPipe_impl::PageChunk::full ( ) const
inline

return true if no free page groups in this chunk

Definition at line 117 of file BidirMMapPipe.h.

unsigned BidirMMapPipe_impl::PageChunk::getPageSize ( )
staticprivate

determine page size at run time

Definition at line 325 of file BidirMMapPipe.cxx.

unsigned BidirMMapPipe_impl::PageChunk::len ( ) const
inline

return length of chunk

Definition at line 105 of file BidirMMapPipe.h.

Referenced by ~PageChunk().

static MMapVariety BidirMMapPipe_impl::PageChunk::mmapVariety ( )
inlinestatic

return mmap variety support found

Definition at line 87 of file BidirMMapPipe.h.

Referenced by BidirMMapPipe::recvpages(), and BidirMMapPipe::sendpages().

unsigned BidirMMapPipe_impl::PageChunk::nPagesPerGroup ( ) const
inline

return number of pages per page group

Definition at line 111 of file BidirMMapPipe.h.

PageChunk& BidirMMapPipe_impl::PageChunk::operator= ( const PageChunk )
inlineprivate

forbid assignment

Definition at line 82 of file BidirMMapPipe.h.

static unsigned BidirMMapPipe_impl::PageChunk::pagesize ( )
inlinestatic

return the page size of the system

Definition at line 85 of file BidirMMapPipe.h.

Referenced by BidirMMapPipe_impl::Pages::pagesize(), and zap().

Pages BidirMMapPipe_impl::PageChunk::pop ( )

pop a group of pages off the free list

Definition at line 364 of file BidirMMapPipe.cxx.

void BidirMMapPipe_impl::PageChunk::push ( const Pages p)

push a group of pages onto the free list

Definition at line 373 of file BidirMMapPipe.cxx.

Referenced by BidirMMapPipe_impl::Pages::operator=(), and BidirMMapPipe_impl::Pages::~Pages().

void BidirMMapPipe_impl::PageChunk::zap ( Pages p)

free all pages except for those pointed to by p

Definition at line 541 of file BidirMMapPipe.cxx.

Member Data Documentation

void* BidirMMapPipe_impl::PageChunk::m_begin
private

pointer to start of mmapped area

Definition at line 63 of file BidirMMapPipe.h.

Referenced by PageChunk(), zap(), and ~PageChunk().

void* BidirMMapPipe_impl::PageChunk::m_end
private

pointer one behind end of mmapped area

Definition at line 64 of file BidirMMapPipe.h.

Referenced by len(), PageChunk(), and zap().

std::list<void*> BidirMMapPipe_impl::PageChunk::m_freelist
private

free pages list

Definition at line 67 of file BidirMMapPipe.h.

Referenced by PageChunk(), pop(), push(), and zap().

unsigned BidirMMapPipe_impl::PageChunk::m_nPgPerGrp
private

number of pages per group

Definition at line 69 of file BidirMMapPipe.h.

Referenced by nPagesPerGroup(), and pop().

unsigned BidirMMapPipe_impl::PageChunk::m_nUsedGrp
private

number of used page groups

Definition at line 70 of file BidirMMapPipe.h.

Referenced by empty(), pop(), push(), and zap().

PagePool* BidirMMapPipe_impl::PageChunk::m_parent
private

parent page pool

Definition at line 68 of file BidirMMapPipe.h.

Referenced by push(), zap(), and ~PageChunk().

PageChunk::MMapVariety BidirMMapPipe_impl::PageChunk::s_mmapworks = PageChunk::Unknown
staticprivate

mmap variety that works on this system

Definition at line 58 of file BidirMMapPipe.h.

Referenced by dommap(), domunmap(), getPageSize(), mmapVariety(), and zap().

unsigned BidirMMapPipe_impl::PageChunk::s_pagesize = PageChunk::getPageSize()
staticprivate

system page size (run-time determined)

Definition at line 56 of file BidirMMapPipe.h.

Referenced by dommap(), domunmap(), and pagesize().


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