aboutsummaryrefslogtreecommitdiffstats
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
authorWu Fengguang <fengguang.wu@intel.com>2009-12-16 06:19:58 -0500
committerAndi Kleen <ak@linux.intel.com>2009-12-16 06:19:58 -0500
commit8d22ba1b74aa9420b6032d856446564fb21f8090 (patch)
tree6c2e2d27e81d784faa0481500f1cecc613ff1167 /mm/page_alloc.c
parent95d01fc664b9476e0d18e3d745bb209a42a33588 (diff)
HWPOISON: detect free buddy pages explicitly
Most free pages in the buddy system have no PG_buddy set. Introduce is_free_buddy_page() for detecting them reliably. CC: Nick Piggin <npiggin@suse.de> CC: Mel Gorman <mel@linux.vnet.ibm.com> Signed-off-by: Wu Fengguang <fengguang.wu@intel.com> Signed-off-by: Andi Kleen <ak@linux.intel.com>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r--mm/page_alloc.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 59d2e88fb47c..6867b4d391fd 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5081,3 +5081,24 @@ __offline_isolated_pages(unsigned long start_pfn, unsigned long end_pfn)
5081 spin_unlock_irqrestore(&zone->lock, flags); 5081 spin_unlock_irqrestore(&zone->lock, flags);
5082} 5082}
5083#endif 5083#endif
5084
5085#ifdef CONFIG_MEMORY_FAILURE
5086bool is_free_buddy_page(struct page *page)
5087{
5088 struct zone *zone = page_zone(page);
5089 unsigned long pfn = page_to_pfn(page);
5090 unsigned long flags;
5091 int order;
5092
5093 spin_lock_irqsave(&zone->lock, flags);
5094 for (order = 0; order < MAX_ORDER; order++) {
5095 struct page *page_head = page - (pfn & ((1 << order) - 1));
5096
5097 if (PageBuddy(page_head) && page_order(page_head) >= order)
5098 break;
5099 }
5100 spin_unlock_irqrestore(&zone->lock, flags);
5101
5102 return order < MAX_ORDER;
5103}
5104#endif