|
The Pedigree Project 0.1
|
#include <SlamAllocator.h>
Collaboration diagram for SlamCache:Classes | |
| struct | Node |
| struct | Slab |
Public Member Functions | |
| struct SlamCache::Node | __attribute__ ((aligned(16))) |
| SlamCache () | |
| virtual | ~SlamCache () |
| void | initialise (SlamAllocator *parent, size_t objectSize) |
| uintptr_t | allocate () |
| void | free (uintptr_t object) |
| size_t | recovery (size_t maxSlabs) |
| bool | isPointerValid (uintptr_t object) const |
| size_t | objectSize () const |
| size_t | slabSize () const |
| size_t | slabObjectCount () const |
| void | trackSlab (uintptr_t slab) |
| void | check () |
Private Member Functions | |
| SlamCache (const SlamCache &) | |
| const SlamCache & | operator= (const SlamCache &) |
| void | addSlab (Slab *slab, size_t list) |
| void | removeSlab (Slab *slab) |
| bool | beginFastPath () |
| void | endFastPath () |
| Node * | popFreeObject (Slab *slab) |
| void | pushFreeObject (Slab *slab, Node *node) |
| Node * | objectAt (uintptr_t slab, size_t index) const |
| Slab * | slabForObject (uintptr_t object) const |
| uintptr_t | getSlab () |
| void | freeSlab (uintptr_t slab) |
| Node * | initialiseSlab (uintptr_t slab) |
| size_t | currentList () const |
Private Attributes | |
| struct SlamCache::Slab | __attribute__ |
| Slab * | m_PartialLists [NUM_LISTS] |
| Slab * | m_FastSlabs [NUM_LISTS] |
| Node * | m_LargeFreeList |
| size_t | m_ObjectSize |
| size_t | m_SlabSize |
| size_t | m_SlabObjectOffset |
| size_t | m_SlabObjectCount |
| uintptr_t | m_FirstSlab |
| size_t | m_FastPathState |
| Spinlock | m_RecoveryLock |
| SlamAllocator * | m_pParentAllocator |
Static Private Attributes | |
| static constexpr const int | NUM_LISTS |
A cache allocates objects of a constant size.
Definition at line 152 of file SlamAllocator.h.
| SlamCache::SlamCache | ( | ) |
Default constructor, does nothing.
Definition at line 226 of file SlamAllocator.cc.
|
virtual |
Destructor is not designed to be called. There is no cleanup, this is a kernel heap!
Definition at line 244 of file SlamAllocator.cc.
|
private |
Definition at line 298 of file SlamAllocator.cc.
| uintptr_t SlamCache::allocate | ( | ) |
Allocates an object.
Definition at line 395 of file SlamAllocator.cc.
References EMIT_IF, m_pParentAllocator, m_RecoveryLock, and UNLIKELY.
Referenced by SlamAllocator::allocate().
Here is the caller graph for this function:
|
private |
Definition at line 322 of file SlamAllocator.cc.
| void SlamCache::check | ( | ) |
Definition at line 747 of file SlamAllocator.cc.
|
private |
Definition at line 278 of file SlamAllocator.cc.
|
private |
Definition at line 333 of file SlamAllocator.cc.
| void SlamCache::free | ( | uintptr_t | object | ) |
Frees an object.
Definition at line 502 of file SlamAllocator.cc.
References EMIT_IF, and m_RecoveryLock.
|
private |
Definition at line 622 of file SlamAllocator.cc.
|
private |
Definition at line 618 of file SlamAllocator.cc.
| void SlamCache::initialise | ( | SlamAllocator * | parent, |
| size_t | objectSize | ||
| ) |
|
private |
Definition at line 690 of file SlamAllocator.cc.
| bool SlamCache::isPointerValid | ( | uintptr_t | object | ) | const |
Definition at line 586 of file SlamAllocator.cc.
|
private |
Definition at line 386 of file SlamAllocator.cc.
|
inline |
Definition at line 189 of file SlamAllocator.h.
|
private |
Definition at line 337 of file SlamAllocator.cc.
Definition at line 369 of file SlamAllocator.cc.
| size_t SlamCache::recovery | ( | size_t | maxSlabs | ) |
Attempt to recover slabs from this cache.
Definition at line 626 of file SlamAllocator.cc.
References EMIT_IF, and m_RecoveryLock.
|
private |
Definition at line 309 of file SlamAllocator.cc.
|
private |
Definition at line 390 of file SlamAllocator.cc.
|
inline |
Definition at line 197 of file SlamAllocator.h.
|
inline |
Definition at line 193 of file SlamAllocator.h.
| void SlamCache::trackSlab | ( | uintptr_t | slab | ) |
Definition at line 803 of file SlamAllocator.cc.
|
private |
Definition at line 255 of file SlamAllocator.h.
|
private |
Definition at line 227 of file SlamAllocator.h.
|
private |
Definition at line 254 of file SlamAllocator.h.
|
private |
Definition at line 228 of file SlamAllocator.h.
|
private |
Definition at line 245 of file SlamAllocator.h.
|
private |
Definition at line 226 of file SlamAllocator.h.
|
private |
Pointer back to the associated SlamAllocator.
Definition at line 267 of file SlamAllocator.h.
Referenced by allocate(), and initialise().
|
private |
Protects slab-list transitions and the slow paths. Recovery quiesces the lock-free fast path before inspecting or reclaiming slabs.
Definition at line 261 of file SlamAllocator.h.
Referenced by allocate(), free(), and recovery().
|
private |
Definition at line 248 of file SlamAllocator.h.
|
private |
Definition at line 247 of file SlamAllocator.h.
|
private |
Definition at line 246 of file SlamAllocator.h.
|
staticconstexprprivate |
Definition at line 219 of file SlamAllocator.h.