Skip to main content

release_owned_block

Function release_owned_block 

Source
pub fn release_owned_block(block: PhysBlock<Released>)
Expand description

Releases a block back to the buddy allocator.

Lifecycle order:

  1. Invoke per-block FrameMetaVtable::on_last_ref (once, for the head frame) : signals that the last shared ownership reference has been dropped.
  2. Invoke per-page FrameMetaVtable::on_unmap hooks (once per constituent 4 KiB page) : signals that mappings are being torn down.
  3. Return the block to buddy. Poisoned frames (meta_guard::POISONED) are quarantined and not recycled (poison_quarantine_pages_snapshot).

ยงHook ordering guarantee

on_last_ref and on_unmap are called before the buddy allocator decides to recycle or quarantine. Hooks that rely on the frame being recyclable may run pointlessly on poisoned blocks : they must therefore be idempotent and side-effect-safe.