class ContiguousPooledMemoryAllocator
Defined at line 25 of file ../../src/sysmem/server/contiguous_pooled_memory_allocator.h
Public Members
static duration kDefaultUnusedPageCheckCyclePeriod
static duration kUnusedRecentlyPageCheckPeriod
static duration kUnusedRecentlyAgeThreshold
static duration kStepTowardOptimalProtectedRangesPeriod
static const uint64_t kUnusedGuardPatternPeriodPages
Public Methods
bool is_empty ()
Defined at line 69 of file ../../src/sysmem/server/contiguous_pooled_memory_allocator.h
zx_status_t GetPhysicalMemoryInfo (uint64_t * base, uint64_t * size)
Defined at line 75 of file ../../src/sysmem/server/contiguous_pooled_memory_allocator.h
const zx::vmo & GetPoolVmoForTest ()
Defined at line 87 of file ../../src/sysmem/server/contiguous_pooled_memory_allocator.h
uint64_t failed_guard_region_checks ()
Defined at line 91 of file ../../src/sysmem/server/contiguous_pooled_memory_allocator.h
void ContiguousPooledMemoryAllocator (Owner * parent_device, const char * heap_name, inspect::Node * parent_node, std::optional<fuchsia_sysmem2::Heap> heap, uint64_t size, bool is_always_cpu_accessible, bool is_ever_cpu_accessible, bool is_ever_zircon_accessible, bool is_ready, bool can_be_torn_down, async_dispatcher_t * dispatcher)
The heap can be nullopt initially, but in that case set_heap() must be used to set the heap
before set_ready().
The heap_name must be a string literal (or equivalent null termination and lifetime) because
heap_name is used to call TRACE_* macros.
Defined at line 94 of file ../../src/sysmem/server/contiguous_pooled_memory_allocator.cc
void SetBtiFakeForUnitTests ()
When this is set from unit tests only, we skip any operation that's only allowed on contiguous
VMOs, since we don't have a real contiguous VMO, since a fake BTI can't be used to create one.
This ends up limiting the fidelity of the unit tests somewhat; in the long run we probably
should plumb a real BTI to the unit tests somehow.
Defined at line 99 of file ../../src/sysmem/server/contiguous_pooled_memory_allocator.h
bool is_bti_fake ()
Defined at line 103 of file ../../src/sysmem/server/contiguous_pooled_memory_allocator.h
const fuchsia_sysmem2::Heap & heap ()
Defined at line 105 of file ../../src/sysmem/server/contiguous_pooled_memory_allocator.h
void ~ContiguousPooledMemoryAllocator ()
Defined at line 248 of file ../../src/sysmem/server/contiguous_pooled_memory_allocator.cc
zx_status_t Init (uint32_t alignment_log2)
Alignment gets rounded up to system page alignment, so any low number will default to system
page alignment.
Defined at line 264 of file ../../src/sysmem/server/contiguous_pooled_memory_allocator.cc
void InitGuardRegion (size_t guard_region_size, bool unused_pages_guarded, int64_t unused_guard_pattern_period_bytes, zx::duration unused_page_check_cycle_period, bool internal_guard_regions, bool crash_on_guard_failure, async_dispatcher_t * dispatcher)
Initializes the guard regions. Must be called after Init. If
internal_guard_regions is not set, there will be only guard regions at the
begin and end of the buffer.
Defined at line 158 of file ../../src/sysmem/server/contiguous_pooled_memory_allocator.cc
void FillUnusedRangeWithGuard (uint64_t start_offset, uint64_t size)
Defined at line 232 of file ../../src/sysmem/server/contiguous_pooled_memory_allocator.cc
void SetupUnusedPages ()
If is_cpu_accessibe_, called after InitGuardRegion() (if any), but during the same dispatcher
call-out, before returning to the dispatcher, because is_ready_ is already true.
If !is_cpu_accessibe_, called during set_ready().
Defined at line 216 of file ../../src/sysmem/server/contiguous_pooled_memory_allocator.cc
zx_status_t InitPhysical (zx_paddr_t paddr)
This uses a physical VMO as the parent VMO. This is used for VDEC as we learn the physical
range of VDEC from the TEE.
Defined at line 282 of file ../../src/sysmem/server/contiguous_pooled_memory_allocator.cc
zx_status_t Allocate (uint64_t raw_vmo_size, const fuchsia_sysmem2::SingleBufferSettings & settings, std::optional<std::string> name, uint64_t buffer_collection_id, uint32_t buffer_index, zx::vmo * parent_vmo)
Defined at line 419 of file ../../src/sysmem/server/contiguous_pooled_memory_allocator.cc
void Delete (zx::vmo parent_vmo)
Defined at line 579 of file ../../src/sysmem/server/contiguous_pooled_memory_allocator.cc
void set_heap (fuchsia_sysmem2::Heap heap)
Defined at line 611 of file ../../src/sysmem/server/contiguous_pooled_memory_allocator.cc
void set_ready ()
Defined at line 617 of file ../../src/sysmem/server/contiguous_pooled_memory_allocator.cc
void clear_ready ()
Defined at line 631 of file ../../src/sysmem/server/contiguous_pooled_memory_allocator.cc
bool is_ready ()
Defined at line 741 of file ../../src/sysmem/server/contiguous_pooled_memory_allocator.cc
uint64_t GetVmoRegionOffsetForTest (const zx::vmo & vmo)
Gets the offset of a VMO from the beginning of a pool.
Defined at line 1283 of file ../../src/sysmem/server/contiguous_pooled_memory_allocator.cc
bool is_already_cleared_on_allocate ()
Defined at line 1287 of file ../../src/sysmem/server/contiguous_pooled_memory_allocator.cc
double GetLoanableEfficiency ()
loanable pages / un-used pages
Defined at line 1445 of file ../../src/sysmem/server/contiguous_pooled_memory_allocator.cc
double GetLoanableRatio ()
loanable pages / total pages
Defined at line 1458 of file ../../src/sysmem/server/contiguous_pooled_memory_allocator.cc
uint64_t GetLoanableBytes ()
loanable bytes
We count pages we choose to pattern instead of loan as loanable, despite not actually loaning
those pages. In other words we don't count patterned pages against the loaned ratio.
Defined at line 1471 of file ../../src/sysmem/server/contiguous_pooled_memory_allocator.cc