Logo ROOT  
Reference Guide
BidirMMapPipe_impl::PagePool Class Reference

class representing a page pool

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

pool of mmapped pages (on systems which support it, on all others, the functionality is emulated with dynamically allocated memory)

in most operating systems there is a limit to how many mappings any one process is allowed to request; for this reason, we mmap a relatively large amount up front, and then carve off little pieces as we need them

Moreover, some systems have too large a physical page size in their MMU for the code to handle (we want offsets and lengths to fit into 16 bits), so we carve such big physical pages into smaller logical Pages if needed. The largest logical page size is currently 16 KiB.

Definition at line 206 of file BidirMMapPipe.cxx.

Public Types

typedef PageChunk::MMapVariety MMapVariety
 convenience typedef More...
 

Public Member Functions

 PagePool (unsigned nPagesPerGroup)
 constructor More...
 
 ~PagePool ()
 destructor More...
 
unsigned nPagesPerGroup () const
 return number of pages per group (ie. as returned by pop()) More...
 
Pages pop ()
 pop a free element out of the pool More...
 
void zap (Pages &p)
 zap the pool (unmap all but Pages p) More...
 

Static Public Member Functions

static MMapVariety mmapVariety ()
 return variety of mmap supported on the system More...
 
static unsigned pagesize ()
 return (logical) page size of the system More...
 

Private Types

enum  { minsz = 7 , maxsz = 20 , szincr = 1 }
 
typedef BidirMMapPipe_impl::PageChunk Chunk
 a chunk of memory in the pool More...
 
typedef std::list< Chunk * > ChunkList
 list of chunks More...
 
typedef BidirMMapPipeException Exception
 convenience typedef More...
 

Private Member Functions

int nextChunkSz () const
 find size of next chunk to allocate (in a hopefully smart way) More...
 
void putOnFreeList (Chunk *chunk)
 release a chunk More...
 
void release (Chunk *chunk)
 release a chunk More...
 
void updateCurSz (int sz, int incr)
 adjust _cursz to current largest block More...
 

Private Attributes

ChunkList m_chunks
 list of chunks used by the pool More...
 
int m_cursz
 current chunk size More...
 
ChunkList m_freelist
 list of chunks used by the pool which are not full More...
 
unsigned m_nPgPerGrp
 page group size More...
 
unsigned m_szmap [(maxsz - minsz)/szincr]
 chunk size map (histogram of chunk sizes) More...
 

Friends

class BidirMMapPipe_impl::PageChunk
 

Member Typedef Documentation

◆ Chunk

a chunk of memory in the pool

Definition at line 217 of file BidirMMapPipe.cxx.

◆ ChunkList

typedef std::list<Chunk*> BidirMMapPipe_impl::PagePool::ChunkList
private

list of chunks

Definition at line 219 of file BidirMMapPipe.cxx.

◆ Exception

convenience typedef

Definition at line 209 of file BidirMMapPipe.cxx.

◆ MMapVariety

convenience typedef

Definition at line 224 of file BidirMMapPipe.cxx.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
minsz 

minimum chunk size (just below 1 << minsz bytes)

maxsz 

maximum chunk size (just below 1 << maxsz bytes)

szincr 

size class increment (sz = 1 << (minsz + k * szincr))

Definition at line 211 of file BidirMMapPipe.cxx.

Constructor & Destructor Documentation

◆ PagePool()

BidirMMapPipe_impl::PagePool::PagePool ( unsigned  nPagesPerGroup)

constructor

Definition at line 575 of file BidirMMapPipe.cxx.

◆ ~PagePool()

BidirMMapPipe_impl::PagePool::~PagePool ( )

destructor

Definition at line 603 of file BidirMMapPipe.cxx.

Member Function Documentation

◆ mmapVariety()

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

return variety of mmap supported on the system

Definition at line 235 of file BidirMMapPipe.cxx.

◆ nextChunkSz()

int BidirMMapPipe_impl::PagePool::nextChunkSz ( ) const
private

find size of next chunk to allocate (in a hopefully smart way)

Definition at line 683 of file BidirMMapPipe.cxx.

◆ nPagesPerGroup()

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

return number of pages per group (ie. as returned by pop())

Definition at line 239 of file BidirMMapPipe.cxx.

◆ pagesize()

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

return (logical) page size of the system

Definition at line 233 of file BidirMMapPipe.cxx.

◆ pop()

Pages BidirMMapPipe_impl::PagePool::pop ( )

pop a free element out of the pool

Definition at line 627 of file BidirMMapPipe.cxx.

◆ putOnFreeList()

void BidirMMapPipe_impl::PagePool::putOnFreeList ( Chunk chunk)
private

release a chunk

Definition at line 665 of file BidirMMapPipe.cxx.

◆ release()

void BidirMMapPipe_impl::PagePool::release ( Chunk chunk)
private

release a chunk

Definition at line 646 of file BidirMMapPipe.cxx.

◆ updateCurSz()

void BidirMMapPipe_impl::PagePool::updateCurSz ( int  sz,
int  incr 
)
private

adjust _cursz to current largest block

Definition at line 671 of file BidirMMapPipe.cxx.

◆ zap()

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

zap the pool (unmap all but Pages p)

Definition at line 611 of file BidirMMapPipe.cxx.

Friends And Related Function Documentation

◆ BidirMMapPipe_impl::PageChunk

friend class BidirMMapPipe_impl::PageChunk
friend

Definition at line 221 of file BidirMMapPipe.cxx.

Member Data Documentation

◆ m_chunks

ChunkList BidirMMapPipe_impl::PagePool::m_chunks
private

list of chunks used by the pool

Definition at line 246 of file BidirMMapPipe.cxx.

◆ m_cursz

int BidirMMapPipe_impl::PagePool::m_cursz
private

current chunk size

Definition at line 252 of file BidirMMapPipe.cxx.

◆ m_freelist

ChunkList BidirMMapPipe_impl::PagePool::m_freelist
private

list of chunks used by the pool which are not full

Definition at line 248 of file BidirMMapPipe.cxx.

◆ m_nPgPerGrp

unsigned BidirMMapPipe_impl::PagePool::m_nPgPerGrp
private

page group size

Definition at line 254 of file BidirMMapPipe.cxx.

◆ m_szmap

unsigned BidirMMapPipe_impl::PagePool::m_szmap[(maxsz - minsz)/szincr]
private

chunk size map (histogram of chunk sizes)

Definition at line 250 of file BidirMMapPipe.cxx.


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