Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 28893
b: refs/heads/master
c: cb2b95e
h: refs/heads/master
i:
  28891: 4eacdf3
v: v3
  • Loading branch information
Andy Whitcroft authored and Linus Torvalds committed Jun 23, 2006
1 parent 4e898a1 commit 96d49e8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6f0419e06a3b151ab616a31accdabef41dc2d1b0
refs/heads/master: cb2b95e1c6b56e3d2369d3a5f4bc97f4fa180683
7 changes: 5 additions & 2 deletions trunk/include/linux/mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -465,10 +465,13 @@ static inline unsigned long page_zonenum(struct page *page)
struct zone;
extern struct zone *zone_table[];

static inline int page_zone_id(struct page *page)
{
return (page->flags >> ZONETABLE_PGSHIFT) & ZONETABLE_MASK;
}
static inline struct zone *page_zone(struct page *page)
{
return zone_table[(page->flags >> ZONETABLE_PGSHIFT) &
ZONETABLE_MASK];
return zone_table[page_zone_id(page)];
}

static inline unsigned long page_to_nid(struct page *page)
Expand Down
17 changes: 11 additions & 6 deletions trunk/mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,22 +286,27 @@ __find_combined_index(unsigned long page_idx, unsigned int order)
* we can do coalesce a page and its buddy if
* (a) the buddy is not in a hole &&
* (b) the buddy is in the buddy system &&
* (c) a page and its buddy have the same order.
* (c) a page and its buddy have the same order &&
* (d) a page and its buddy are in the same zone.
*
* For recording whether a page is in the buddy system, we use PG_buddy.
* Setting, clearing, and testing PG_buddy is serialized by zone->lock.
*
* For recording page's order, we use page_private(page).
*/
static inline int page_is_buddy(struct page *page, int order)
static inline int page_is_buddy(struct page *page, struct page *buddy,
int order)
{
#ifdef CONFIG_HOLES_IN_ZONE
if (!pfn_valid(page_to_pfn(page)))
if (!pfn_valid(page_to_pfn(buddy)))
return 0;
#endif

if (PageBuddy(page) && page_order(page) == order) {
BUG_ON(page_count(page) != 0);
if (page_zone_id(page) != page_zone_id(buddy))
return 0;

if (PageBuddy(buddy) && page_order(buddy) == order) {
BUG_ON(page_count(buddy) != 0);
return 1;
}
return 0;
Expand Down Expand Up @@ -352,7 +357,7 @@ static inline void __free_one_page(struct page *page,
struct page *buddy;

buddy = __page_find_buddy(page, page_idx, order);
if (!page_is_buddy(buddy, order))
if (!page_is_buddy(page, buddy, order))
break; /* Move the buddy up one level. */

list_del(&buddy->lru);
Expand Down

0 comments on commit 96d49e8

Please sign in to comment.