Skip to content

Commit b4fb8f6

Browse files
aegltorvalds
authored andcommitted
mm, page_alloc: Add missing check for memory holes
Commit 13ad59d ("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: 13ad59d ("avoid page_to_pfn() when merging buddies") Cc: Mel Gorman <[email protected]> Cc: Joonsoo Kim <[email protected]> Cc: Michal Hocko <[email protected]> Cc: "Kirill A. Shutemov" <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: Andrew Morton <[email protected]> Signed-off-by: Tony Luck <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 8557b8e commit b4fb8f6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mm/page_alloc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,8 @@ static inline void __free_one_page(struct page *page,
873873
higher_page = page + (combined_pfn - pfn);
874874
buddy_pfn = __find_buddy_pfn(combined_pfn, order + 1);
875875
higher_buddy = higher_page + (buddy_pfn - combined_pfn);
876-
if (page_is_buddy(higher_page, higher_buddy, order + 1)) {
876+
if (pfn_valid_within(buddy_pfn) &&
877+
page_is_buddy(higher_page, higher_buddy, order + 1)) {
877878
list_add_tail(&page->lru,
878879
&zone->free_area[order].free_list[migratetype]);
879880
goto out;

0 commit comments

Comments
 (0)