20#ifndef _UTILITY_MEMORY_POOL
21#define _UTILITY_MEMORY_POOL
22#include "pedigree/kernel/compiler.h"
23#include "pedigree/kernel/processor/types.h"
27#include "pedigree/kernel/process/ConditionVariable.h"
28#include "pedigree/kernel/process/Mutex.h"
30#include "pedigree/kernel/process/MemoryPressureManager.h"
31#include "pedigree/kernel/process/TerminationDeferral.h"
32#include "pedigree/kernel/processor/MemoryRegion.h"
33#include "pedigree/kernel/utilities/ExtensibleBitmap.h"
34#include "pedigree/kernel/utilities/String.h"
70 bool initialise(
size_t poolSize,
size_t bufferSize = 1024);
74 return m_bInitialised;
84 uintptr_t allocateNow();
87 void free(uintptr_t buffer);
92#if HOSTED && PEDIGREE_HOSTED_SMOKE_TESTS
94 void acquireHostedOperationLock();
95 void releaseHostedOperationLock();
96 void acquireHostedMappingLock();
97 void releaseHostedMappingLock();
98 size_t getHostedActiveOperationCount();
114 explicit operator bool()
const {
115 return m_Pool !=
nullptr;
126 bool beginOperation();
135#ifndef STANDALONE_MEMPOOL
152#ifndef STANDALONE_MEMPOOL
158 uintptr_t allocateDoer(
bool canBlock);
virtual const char * getMemoryPressureDescription()
size_t m_BufferSize
Size of each buffer in this pool.
bool initialised()
Call if you aren't certain that the object has been initialised yet.
bool m_bInitialised
Has this instance been initialised yet?
ExtensibleBitmap m_AllocBitmap
Allocation bitmap.
size_t m_ActiveOperations
Operations which entered before destruction began.
bool m_bClosing
Destruction has begun; no new operations may enter.
size_t m_BufferCount
Number of buffers we have available.
MemoryRegion m_Pool
MemoryRegion describing the actual pool of memory.
MemoryPoolPressureHandler m_PressureHandler
Memory pressure handler for this pool.
Special memory entity in the kernel's virtual address space.