|
The Pedigree Project 0.1
|
#include <MemoryPressureManager.h>
Collaboration diagram for MemoryPressureManager:Public Member Functions | |
| bool | compact () |
| bool | compactingForCurrentExecution () const |
| void | registerHandler (size_t prio, MemoryPressureHandler *pHandler) |
| void | removeHandler (MemoryPressureHandler *pHandler) |
Static Public Member Functions | |
| static MemoryPressureManager & | instance () |
| static size_t | getHighWatermark () |
| static size_t | getLowWatermark () |
Static Public Attributes | |
| static const size_t | HighestPriority = 0 |
| static const size_t | HighPriority = MAX_MEMPRESSURE_PRIORITY / 3 |
| static const size_t | MediumPriority = MAX_MEMPRESSURE_PRIORITY / 2 |
| static const size_t | LowPriority = (MAX_MEMPRESSURE_PRIORITY * 2) / 3 |
| static const size_t | LowestPriority = MAX_MEMPRESSURE_PRIORITY - 1 |
Private Attributes | |
| Spinlock | m_Lock |
| MemoryPressureHandler * | m_Handlers [MAX_MEMPRESSURE_PRIORITY] |
| MemoryPressureHandler * | m_HandlerTails [MAX_MEMPRESSURE_PRIORITY] |
| size_t | m_NextRegistrationSequence |
| Atomic< bool > | m_bCompacting |
| const void * | m_pCompactOwner |
| WaitQueue | m_CompactWaiters |
Static Private Attributes | |
| static MemoryPressureManager | m_Instance |
MemoryPressureManager: global memory pressure handling.
This class offers a central interface for the various mechanisms available to alleviate memory pressure to register themselves and be called, without requiring the kernel itself to know about them (eg, loadable modules).
Definition at line 80 of file MemoryPressureManager.h.
| MemoryPressureManager::MemoryPressureManager | ( | ) |
Definition at line 199 of file MemoryPressureManager.cc.
| bool MemoryPressureManager::compact | ( | ) |
Attempt to alleviate memory pressure by requesting registered handlers release pages that can be safely released.
Registry state is never locked across a callback. A callback may register or remove another handler. Removing the currently executing handler from its own callback is rejected because a synchronous removal cannot wait for itself to finish.
Definition at line 66 of file MemoryPressureManager.cc.
References assert, MemoryPressureHandler::compact(), ProcessorBase::getInterrupts(), MemoryPressureHandler::getMemoryPressureDescription(), ProcessorBase::information(), MemoryPressureHandler::m_CallbacksInFlight, and ProcessorBase::m_Initialised.
Referenced by HostedPhysicalMemoryManager::allocatePage(), and X86CommonPhysicalMemoryManager::allocatePage().
Here is the caller graph for this function:| bool MemoryPressureManager::compactingForCurrentExecution | ( | ) | const |
True while the current execution context is already inside compact(). Physical allocators use this to permit callback allocations without recursively starting another pressure pass.
Definition at line 194 of file MemoryPressureManager.cc.
Referenced by HostedPhysicalMemoryManager::allocatePage(), and X86CommonPhysicalMemoryManager::allocatePage().
Here is the caller graph for this function:
|
inlinestatic |
Definition at line 95 of file MemoryPressureManager.h.
|
inlinestatic |
Definition at line 103 of file MemoryPressureManager.h.
|
inlinestatic |
Definition at line 91 of file MemoryPressureManager.h.
| void MemoryPressureManager::registerHandler | ( | size_t | prio, |
| MemoryPressureHandler * | pHandler | ||
| ) |
Register a new handler.
Definition at line 215 of file MemoryPressureManager.cc.
References MemoryPressureHandler::m_CallbacksInFlight.
Referenced by MemoryPool::initialise(), and MemoryMapManager::MemoryMapManager().
Here is the caller graph for this function:| void MemoryPressureManager::removeHandler | ( | MemoryPressureHandler * | pHandler | ) |
Remove a handler.
Definition at line 252 of file MemoryPressureManager.cc.
References assert, ProcessorBase::getInterrupts(), ProcessorBase::information(), and MemoryPressureHandler::m_CallbacksInFlight.
|
static |
Definition at line 85 of file MemoryPressureManager.h.
|
static |
Definition at line 86 of file MemoryPressureManager.h.
|
static |
Definition at line 89 of file MemoryPressureManager.h.
|
static |
Definition at line 88 of file MemoryPressureManager.h.
|
private |
Definition at line 145 of file MemoryPressureManager.h.
|
private |
Definition at line 148 of file MemoryPressureManager.h.
|
private |
Definition at line 142 of file MemoryPressureManager.h.
|
private |
Definition at line 143 of file MemoryPressureManager.h.
|
staticprivate |
Definition at line 139 of file MemoryPressureManager.h.
|
private |
Definition at line 141 of file MemoryPressureManager.h.
|
private |
Definition at line 144 of file MemoryPressureManager.h.
|
private |
Definition at line 146 of file MemoryPressureManager.h.
|
static |
Definition at line 87 of file MemoryPressureManager.h.