aboutsummaryrefslogtreecommitdiffstats
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2012-02-27 14:04:40 -0700
committerGrant Likely <grant.likely@secretlab.ca>2012-02-27 14:04:40 -0700
commit29f141fed01a09050207c4d41fc5811520d81146 (patch)
treec55a51dca4a0e4da9fdc2b904eefbde37d2a5b03 /mm/page_alloc.c
parentdt: add empty of_find_compatible_node function (diff)
parentdoc: dt: Fix broken reference in gpio-leds documentation (diff)
downloadlinux-dev-29f141fed01a09050207c4d41fc5811520d81146.tar.xz
linux-dev-29f141fed01a09050207c4d41fc5811520d81146.zip
Merge branch 'fixes-for-grant' of git://sources.calxeda.com/kernel/linux into devicetree/merge
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r--mm/page_alloc.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 0027d8f4a1bb..a13ded1938f0 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5236,6 +5236,7 @@ void *__init alloc_large_system_hash(const char *tablename,
max = ((unsigned long long)nr_all_pages << PAGE_SHIFT) >> 4;
do_div(max, bucketsize);
}
+ max = min(max, 0x80000000ULL);
if (numentries > max)
numentries = max;
@@ -5413,7 +5414,25 @@ __count_immobile_pages(struct zone *zone, struct page *page, int count)
bool is_pageblock_removable_nolock(struct page *page)
{
- struct zone *zone = page_zone(page);
+ struct zone *zone;
+ unsigned long pfn;
+
+ /*
+ * We have to be careful here because we are iterating over memory
+ * sections which are not zone aware so we might end up outside of
+ * the zone but still within the section.
+ * We have to take care about the node as well. If the node is offline
+ * its NODE_DATA will be NULL - see page_zone.
+ */
+ if (!node_online(page_to_nid(page)))
+ return false;
+
+ zone = page_zone(page);
+ pfn = page_to_pfn(page);
+ if (zone->zone_start_pfn > pfn ||
+ zone->zone_start_pfn + zone->spanned_pages <= pfn)
+ return false;
+
return __count_immobile_pages(zone, page, 0);
}