Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 177622
b: refs/heads/master
c: 8d22ba1
h: refs/heads/master
v: v3
  • Loading branch information
Wu Fengguang authored and Andi Kleen committed Dec 16, 2009
1 parent 9e8b21d commit b06d663
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 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: 95d01fc664b9476e0d18e3d745bb209a42a33588
refs/heads/master: 8d22ba1b74aa9420b6032d856446564fb21f8090
3 changes: 3 additions & 0 deletions trunk/mm/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ extern void putback_lru_page(struct page *page);
*/
extern void __free_pages_bootmem(struct page *page, unsigned int order);
extern void prep_compound_page(struct page *page, unsigned long order);
#ifdef CONFIG_MEMORY_FAILURE
extern bool is_free_buddy_page(struct page *page);
#endif


/*
Expand Down
9 changes: 7 additions & 2 deletions trunk/mm/memory-failure.c
Original file line number Diff line number Diff line change
Expand Up @@ -807,8 +807,13 @@ int __memory_failure(unsigned long pfn, int trapno, int flags)
*/
if (!(flags & MF_COUNT_INCREASED) &&
!get_page_unless_zero(compound_head(p))) {
action_result(pfn, "free or high order kernel", IGNORED);
return PageBuddy(compound_head(p)) ? 0 : -EBUSY;
if (is_free_buddy_page(p)) {
action_result(pfn, "free buddy", DELAYED);
return 0;
} else {
action_result(pfn, "high order kernel", IGNORED);
return -EBUSY;
}
}

/*
Expand Down
21 changes: 21 additions & 0 deletions trunk/mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -5081,3 +5081,24 @@ __offline_isolated_pages(unsigned long start_pfn, unsigned long end_pfn)
spin_unlock_irqrestore(&zone->lock, flags);
}
#endif

#ifdef CONFIG_MEMORY_FAILURE
bool is_free_buddy_page(struct page *page)
{
struct zone *zone = page_zone(page);
unsigned long pfn = page_to_pfn(page);
unsigned long flags;
int order;

spin_lock_irqsave(&zone->lock, flags);
for (order = 0; order < MAX_ORDER; order++) {
struct page *page_head = page - (pfn & ((1 << order) - 1));

if (PageBuddy(page_head) && page_order(page_head) >= order)
break;
}
spin_unlock_irqrestore(&zone->lock, flags);

return order < MAX_ORDER;
}
#endif

0 comments on commit b06d663

Please sign in to comment.