Commit Graph

3 Commits

  • feat(diagnostics): count imported memory and BO views by process
    native_adreno_import_memory holds the imports alive, their KiB, the peak and
    the imports made; native_adreno_import_owners holds the importing processes
    (pid, live KiB, live imports, peak KiB). An import pins its pages from
    importTask until release, so these are the bytes the driver keeps wired
    besides its own BOs.
    
    native_adreno_view_owners holds the BO views each process maps. A view is an
    IOKit mapping, which the VM bills to the mapping task by its whole size
    (iokit_mapped, part of the footprint the memory limits judge).
    
    The holder table of native_adreno_bo_owners is shared by the three tables
    (NativeAdrenoNoteHolder). Host tests cover the holder rows and the import
    accounting. Not run on hardware.
  • perf(memory): make and wire BoAlloc's pages outside the lock
    The descriptor of a user BO's system memory is made, wired and, for
    default-attribute pages, written back before the driver's lock is taken;
    allocateSystem adopts it under the lock and pages it does not take are
    given back after the call. i14aef633e held the lock 4.0 s in 5454
    allocations while every other process's submit and wait poll queued.
  • perf(memory): user BOs from system memory, no fixed BO pool
    User BOs are pageable IOBufferMemoryDescriptors with no task and no
    kernel mapping, wired by prepare(), as Metal resources are system
    memory. The VM zero-fills them and sets the write-combined attribute in
    one batch while wiring, and restores it when the object is reaped.
    Client views map the descriptor itself, so no device-pager view resets
    the page attribute and submissions no longer re-assert it.
    
    The 1536 MiB boot-time pool is gone. In untagged-ed1611b1 it filled
    with the runtime's blocks, 404 BOs fell back to scattered kernel memory,
    96 allocations of 96 MiB failed and the pressure flag stayed set.
    Memory pressure is now reported when the system refuses a BO.
    Imports are proven exclusive through a page bitmap of the driver's own
    BOs instead of a pairwise span check.