Lines Matching defs:buddy
357 * This function returns the order of a free page in the buddy system. In
384 * This function checks whether a page is free && is the buddy
385 * we can coalesce a page and its buddy if
386 * (a) the buddy is not in a hole (check before calling!) &&
387 * (b) the buddy is in the buddy system &&
388 * (c) a page and its buddy have the same order &&
389 * (d) a page and its buddy are in the same zone.
391 * For recording whether a page is in the buddy system, we set PageBuddy.
396 static inline bool page_is_buddy(struct page *page, struct page *buddy,
399 if (!page_is_guard(buddy) && !PageBuddy(buddy))
402 if (buddy_order(buddy) != order)
409 if (page_zone_id(page) != page_zone_id(buddy))
412 VM_BUG_ON_PAGE(page_count(buddy) != 0, buddy);
418 * Locate the struct page for both the matching buddy in our
421 * 1) Any buddy B1 will have an order O twin B2 which satisfies
424 * For example, if the starting buddy (buddy2) is #8 its order
425 * 1 buddy is #10:
428 * 2) Any buddy B will have an order O+1 parent P which
441 * Find the buddy of @page and validate it.
446 * @buddy_pfn: The output pointer to the buddy pfn, it also saves a call to
449 * The found buddy can be a non PageBuddy, out of @page's zone, or its order is
452 * Return: the found buddy page or NULL if not found.
458 struct page *buddy;
460 buddy = page + (__buddy_pfn - pfn);
464 if (page_is_buddy(page, buddy, order))
465 return buddy;