summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorTony Luck <tony.luck@intel.com>2017-03-08 18:35:39 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2017-03-08 20:10:10 +0100
commitb4fb8f66f1ae2e167d06c12d018025a8d4d3ba7e (patch)
tree919fe4cb94b39a50fc2a7566e1a9e96b24a0c987 /mm
parentMerge tag 'ktest-v4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/... (diff)
downloadlinux-b4fb8f66f1ae2e167d06c12d018025a8d4d3ba7e.tar.xz
linux-b4fb8f66f1ae2e167d06c12d018025a8d4d3ba7e.zip
mm, page_alloc: Add missing check for memory holes
Commit 13ad59df67f1 ("mm, page_alloc: avoid page_to_pfn() when merging buddies") moved the check for memory holes out of page_is_buddy() and had the callers do the check. But this wasn't done correctly in one place which caused ia64 to crash very early in boot. Update to fix that and make ia64 boot again. [ v2: Vlastimil pointed out we don't need to call page_to_pfn() since we already have the result of that in "buddy_pfn" ] Fixes: 13ad59df67f1 ("avoid page_to_pfn() when merging buddies") Cc: Mel Gorman <mgorman@techsingularity.net> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> Cc: Michal Hocko <mhocko@kernel.org> Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Tony Luck <tony.luck@intel.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/page_alloc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index eaa64d2ffdc5..6cbde310abed 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -873,7 +873,8 @@ done_merging:
higher_page = page + (combined_pfn - pfn);
buddy_pfn = __find_buddy_pfn(combined_pfn, order + 1);
higher_buddy = higher_page + (buddy_pfn - combined_pfn);
- if (page_is_buddy(higher_page, higher_buddy, order + 1)) {
+ if (pfn_valid_within(buddy_pfn) &&
+ page_is_buddy(higher_page, higher_buddy, order + 1)) {
list_add_tail(&page->lru,
&zone->free_area[order].free_list[migratetype]);
goto out;