From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753661AbdCHRmA (ORCPT ); Wed, 8 Mar 2017 12:42:00 -0500 Received: from mga06.intel.com ([134.134.136.31]:41472 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751160AbdCHRl7 (ORCPT ); Wed, 8 Mar 2017 12:41:59 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,265,1486454400"; d="scan'208";a="942085309" From: "Luck, Tony" To: Vlastimil Babka Cc: Tony Luck , Mel Gorman , Joonsoo Kim , Michal Hocko , "Kirill A. Shutemov" , Johannes Weiner , Andrew Morton , Linus Torvalds , LKML Subject: [PATCH v2] mm, page_alloc: Add missing check for memory holes Date: Wed, 8 Mar 2017 09:35:39 -0800 Message-Id: <1488994539-28826-1-git-send-email-tony.luck@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <543cd536-68c7-1d84-4910-6c2e714f01dc@suse.cz> References: <543cd536-68c7-1d84-4910-6c2e714f01dc@suse.cz> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tony Luck commit 13ad59df67f19788f6c22985b1a33e466eceb643 ("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. Fixes: 13ad59df67f1 ("avoid page_to_pfn() when merging buddies") Cc: Mel Gorman Cc: Joonsoo Kim Cc: Michal Hocko Cc: "Kirill A. Shutemov" Cc: Johannes Weiner Cc: Andrew Morton Cc: Linus Torvalds Cc: LKML Signed-off-by: Tony Luck --- v2: Vlastimil pointed out we don't need to call page_to_pfn() we already have the result of that in "buddy_pfn" mm/page_alloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 @@ static inline void __free_one_page(struct page *page, 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; -- 2.7.4