mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: mel@skynet.ie (Mel Gorman)
To: akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, clameter@engr.sgi.com
Subject: [PATCH] 2.6.21-rc2-mm2 Fix boot problem on IA64 with CONFIG_HOLE_IN_ZONES and CONFIG_PAGE_GROUP_BY_MOBILITY
Date: Wed, 7 Mar 2007 21:13:59 +0000	[thread overview]
Message-ID: <20070307211359.GA6736@skynet.ie> (raw)

Usually, a mem_map is aligned on MAX_ORDER_NR_PAGES boundaries and the
struct pages are always valid. However, this is not always the case when
CONFIG_HOLES_IN_ZONE is set.

move_freepages_block() checks that pages within a MAX_ORDER_NR_PAGES block
are in the same zone using page_zone(). However, if an invalid page is
passed to page_zone(), it can result in breakage on machines requiring
CONFIG_HOLES_IN_ZONE. This patch avoids the use of page_zone() and instead
checks the PFNs against the PFN ranges of the zone.  This fixes a boot
problem on IA64 using the config arch/ia64/configs/sn2_defconfig .

Credit to Christoph Lameter for testing, reporting the bug and verifying
this fixes the problem. Credit to Andy Whitcroft for giving the patch a
quick review to ensure no functionality was changed.

Signed-off-by: Mel Gorman <mel@csn.ul.ie>

diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.21-rc2-mm2-clean/mm/page_alloc.c linux-2.6.21-rc2-mm2-ia64_movefreepages_fix/mm/page_alloc.c
--- linux-2.6.21-rc2-mm2-clean/mm/page_alloc.c	2007-03-07 09:36:31.000000000 +0000
+++ linux-2.6.21-rc2-mm2-ia64_movefreepages_fix/mm/page_alloc.c	2007-03-07 14:17:43.000000000 +0000
@@ -734,18 +734,19 @@ int move_freepages(struct zone *zone,
 
 int move_freepages_block(struct zone *zone, struct page *page, int migratetype)
 {
-	unsigned long start_pfn;
+	unsigned long start_pfn, end_pfn;
 	struct page *start_page, *end_page;
 
 	start_pfn = page_to_pfn(page);
 	start_pfn = start_pfn & ~(MAX_ORDER_NR_PAGES-1);
 	start_page = pfn_to_page(start_pfn);
 	end_page = start_page + MAX_ORDER_NR_PAGES;
+	end_pfn = start_pfn + MAX_ORDER_NR_PAGES;
 
 	/* Do not cross zone boundaries */
-	if (page_zone(page) != page_zone(start_page))
+	if (start_pfn < zone->zone_start_pfn)
 		start_page = page;
-	if (page_zone(page) != page_zone(end_page))
+	if (end_pfn >= zone->zone_start_pfn + zone->spanned_pages)
 		return 0;
 
 	return move_freepages(zone, start_page, end_page, migratetype);
-- 
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab

                 reply	other threads:[~2007-03-07 21:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070307211359.GA6736@skynet.ie \
    --to=mel@skynet.ie \
    --cc=akpm@linux-foundation.org \
    --cc=clameter@engr.sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®