pub fn vfree(ptr: *mut u8, token: &IrqDisabledToken) -> boolExpand description
Free a vmalloc allocation.
Structured as three phases to avoid a spinlock-under-IPI deadlock:
- Under VMALLOC lock : unmap pages (acquires/releases KERNEL_PT_LOCK per page), collect the frame list, update allocator bookkeeping, return the virtual extent to the free list.
- Lock released : TLB shootdown. Remote CPUs servicing the IPI must acknowledge before returning. If VMALLOC were still held here, any remote CPU blocked on VMALLOC could not reach the acknowledgement path, causing a deadlock. Releasing first eliminates the hazard.
- No lock : free physical frames back to the buddy allocator.
Returns true if a region was released (free(NULL) counts as success).
Returns false if the pointer was non-null but did not denote a live
vmalloc mapping in the arena (nothing freed : caller may be leaking).