MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vm_phys_split_pages

Function vm_phys_split_pages

freebsd/vm/vm_phys.c:661–675  ·  view source on GitHub ↗

* Split a contiguous, power of two-sized set of physical pages. * * When this function is called by a page allocation function, the caller * should request insertion at the head unless the order [order, oind) queues * are known to be empty. The objective being to reduce the likelihood of * long-term fragmentation by promoting contemporaneous allocation and * (hopefully) deallocation. */

Source from the content-addressed store, hash-verified

659 * (hopefully) deallocation.
660 */
661static __inline void
662vm_phys_split_pages(vm_page_t m, int oind, struct vm_freelist *fl, int order,
663 int tail)
664{
665 vm_page_t m_buddy;
666
667 while (oind > order) {
668 oind--;
669 m_buddy = &m[1 << oind];
670 KASSERT(m_buddy->order == VM_NFREEORDER,
671 ("vm_phys_split_pages: page %p has unexpected order %d",
672 m_buddy, m_buddy->order));
673 vm_freelist_add(fl, m_buddy, oind, tail);
674 }
675}
676
677/*
678 * Add the physical pages [m, m + npages) at the end of a power-of-two aligned

Callers 1

Calls 1

vm_freelist_addFunction · 0.85

Tested by

no test coverage detected