* 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. */
| 659 | * (hopefully) deallocation. |
| 660 | */ |
| 661 | static __inline void |
| 662 | vm_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 |
no test coverage detected