Lines Matching refs:buddy
404 * This function returns the order of a free page in the buddy system. In
431 * This function checks whether a page is free && is the buddy
432 * we can coalesce a page and its buddy if
433 * (a) the buddy is not in a hole (check before calling!) &&
434 * (b) the buddy is in the buddy system &&
435 * (c) a page and its buddy have the same order &&
436 * (d) a page and its buddy are in the same zone.
438 * For recording whether a page is in the buddy system, we set PageBuddy.
443 static inline bool page_is_buddy(struct page *page, struct page *buddy,
446 if (!page_is_guard(buddy) && !PageBuddy(buddy))
449 if (buddy_order(buddy) != order)
456 if (page_zone_id(page) != page_zone_id(buddy))
459 VM_BUG_ON_PAGE(page_count(buddy) != 0, buddy);
465 * Locate the struct page for both the matching buddy in our
468 * 1) Any buddy B1 will have an order O twin B2 which satisfies
471 * For example, if the starting buddy (buddy2) is #8 its order
472 * 1 buddy is #10:
475 * 2) Any buddy B will have an order O+1 parent P which
488 * Find the buddy of @page and validate it.
493 * @buddy_pfn: The output pointer to the buddy pfn, it also saves a call to
496 * The found buddy can be a non PageBuddy, out of @page's zone, or its order is
499 * Return: the found buddy page or NULL if not found.
505 struct page *buddy;
507 buddy = page + (__buddy_pfn - pfn);
511 if (page_is_buddy(page, buddy, order))
512 return buddy;