From: mel@skynet.ie (Mel Gorman)
To: Andrew Morton <akpm@osdl.org>
Cc: Andre Noll <maan@systemlinux.org>, Andi Kleen <ak@suse.de>,
discuss@x86-64.org, Adrian Bunk <bunk@stusta.de>,
Linus Torvalds <torvalds@osdl.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
David Rientjes <rientjes@cs.washington.edu>
Subject: Re: [discuss] 2.6.19-rc6: known regressions (v4)
Date: Thu, 23 Nov 2006 21:55:45 +0000 [thread overview]
Message-ID: <20061123215545.GA9551@skynet.ie> (raw)
In-Reply-To: <20061123110930.abc4fd9a.akpm@osdl.org>
On (23/11/06 11:09), Andrew Morton didst pronounce:
> On Thu, 23 Nov 2006 12:01:41 +0000
> mel@skynet.ie (Mel Gorman) wrote:
>
> > find_min_pfn_for_node() and find_min_pfn_with_active_regions() both depend
> > on a sorted early_node_map[]. However, sort_node_map() is being called after
> > fin_min_pfn_with_active_regions() in free_area_init_nodes(). In most cases,
> > this is ok, but on at least one x86_64, the SRAT table caused the E820 ranges
> > to be registered out of order. This gave the wrong values for the min PFN
> > range resulting in some pages not being initialised.
> >
> > This patch sorts the early_node_map in find_min_pfn_for_node(). It has
> > been boot tested on x86, x86_64, ppc64 and ia64.
> >
> > Signed-off-by: Mel Gorman <mel@csn.ul.ie>
> >
> > diff -rup linux-2.6.19-rc6-clean/mm/page_alloc.c linux-2.6.19-rc6-sort_in_find_min/mm/page_alloc.c
> > --- linux-2.6.19-rc6-clean/mm/page_alloc.c 2006-11-15 20:03:40.000000000 -0800
> > +++ linux-2.6.19-rc6-sort_in_find_min/mm/page_alloc.c 2006-11-23 02:23:57.000000000 -0800
> > @@ -2612,6 +2612,9 @@ unsigned long __init find_min_pfn_for_no
> > {
> > int i;
> >
> > + /* Regions in the early_node_map can be in any order */
> > + sort_node_map();
> > +
> > /* Assuming a sorted map, the first range found has the starting pfn */
> > for_each_active_range_index_in_nid(i, nid)
> > return early_node_map[i].start_pfn;
> > @@ -2680,9 +2683,6 @@ void __init free_area_init_nodes(unsigne
> > max(max_zone_pfn[i], arch_zone_lowest_possible_pfn[i]);
> > }
> >
> > - /* Regions in the early_node_map can be in any order */
> > - sort_node_map();
> > -
> > /* Print out the zone ranges */
> > printk("Zone PFN ranges:\n");
> > for (i = 0; i < MAX_NR_ZONES; i++)
>
yes, once per active node.
> Seems a bit ... ungainly?
>
It is, but this late in the cycle, I was going for the
obviously-correct-and-will-definitly-work solution.
It would be sufficient to call sort_node_map() in
find_min_pfn_with_active_regions() but I wasn't sure someone would call
find_min_pfn_for_node() at some future time causing another fun bug.
A slightly smarter, but not quite as obviously correct, patch is below if
you prefer it. It removes the assumption about early_node_map being sorted
for find_min_pfns and friends by always searching the whole map. The map
is then only sorted once when it is required. Andre, I'd appreciate it if
you could give it a spin to be 100% sure it's ok. It passed a boot-test on
a few machines here.
===========
find_min_pfn_for_node() and find_min_pfn_with_active_regions() both
depend on a sorted early_node_map[] to find the correct values. However,
sort_node_map() is being called after fin_min_pfn_with_active_regions()
in free_area_init_nodes(). In most cases, this is ok, but on an x86_64,
the SRAT table caused the E820 ranges to be registered out of order. This gave
the wrong values for the min PFN range resulting in some pages not being
initialised.
This patch works by always searching the whole early_node_map[] in
find_min_pfn_for_node().
Signed-off-by: Mel Gorman <mel@csn.ul.ie>
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.19-rc5-mm2-clean/mm/page_alloc.c linux-2.6.19-rc5-mm2-sort_in_find_min/mm/page_alloc.c
--- linux-2.6.19-rc5-mm2-clean/mm/page_alloc.c 2006-11-14 14:01:37.000000000 +0000
+++ linux-2.6.19-rc5-mm2-sort_in_find_min/mm/page_alloc.c 2006-11-23 20:37:18.000000000 +0000
@@ -2945,17 +2945,22 @@ static void __init sort_node_map(void)
cmp_node_active_region, NULL);
}
-/* Find the lowest pfn for a node. This depends on a sorted early_node_map */
+/* Find the lowest pfn for a node */
unsigned long __init find_min_pfn_for_node(unsigned long nid)
{
int i;
+ unsigned long min_pfn = -1UL;
/* Assuming a sorted map, the first range found has the starting pfn */
for_each_active_range_index_in_nid(i, nid)
- return early_node_map[i].start_pfn;
+ min_pfn = min(min_pfn, early_node_map[i].start_pfn);
- printk(KERN_WARNING "Could not find start_pfn for node %lu\n", nid);
- return 0;
+ if (min_pfn == -1UL) {
+ printk(KERN_WARNING "Could not find start_pfn for node %lu\n", nid);
+ return 0;
+ }
+
+ return min_pfn;
}
/**
next prev parent reply other threads:[~2006-11-23 21:55 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-16 4:21 Linux 2.6.19-rc6 Linus Torvalds
2006-11-16 21:37 ` 2.6.19-rc6: known regressions Adrian Bunk
2006-11-16 21:43 ` Greg KH
2006-11-17 20:40 ` 2.6.19-rc6: known regressions (v2) Adrian Bunk
2006-11-18 8:02 ` [PATCH] mm: do not call bad_page on PG_reserved check David Rientjes
2006-11-18 13:37 ` Hugh Dickins
2006-11-18 4:04 ` Linux 2.6.19-rc6 - NFSD working again Christian Kujau
2006-11-20 19:53 ` 2.6.19-rc6: known regressions (v3) Adrian Bunk
2006-11-21 21:24 ` 2.6.19-rc6: known regressions (v4) Adrian Bunk
2006-11-21 21:31 ` [discuss] " Dave Jones
2006-11-21 21:39 ` Adrian Bunk
2006-11-21 21:56 ` Dave Jones
2006-11-21 21:33 ` Vivek Goyal
2006-11-21 21:41 ` Adrian Bunk
2006-11-21 22:18 ` Linus Torvalds
2006-11-22 9:44 ` Pavel Emelianov
2006-11-22 14:58 ` Vivek Goyal
2006-11-22 17:28 ` Linus Torvalds
2006-11-22 10:42 ` [discuss] " Andi Kleen
2006-11-22 15:52 ` Mel Gorman
2006-11-22 17:42 ` Andre Noll
2006-11-23 12:01 ` Mel Gorman
2006-11-23 13:08 ` Andre Noll
2006-11-23 13:28 ` Mel Gorman
2006-11-23 19:09 ` Andrew Morton
2006-11-23 21:55 ` Mel Gorman [this message]
2006-11-24 9:51 ` Andre Noll
2006-11-24 9:58 ` Andi Kleen
2006-11-24 20:43 ` Andrew Morton
2006-11-22 16:05 ` Andre Noll
2006-11-22 17:03 ` Mel Gorman
2006-11-22 17:08 ` Andi Kleen
2006-11-22 18:00 ` Andre Noll
2006-11-23 0:04 ` David Brownell
2006-11-23 0:54 ` 2.6.19-rc6: known regressions with patches available Adrian Bunk
2006-11-23 1:08 ` Andrew Morton
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=20061123215545.GA9551@skynet.ie \
--to=mel@skynet.ie \
--cc=ak@suse.de \
--cc=akpm@osdl.org \
--cc=bunk@stusta.de \
--cc=discuss@x86-64.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maan@systemlinux.org \
--cc=rientjes@cs.washington.edu \
--cc=torvalds@osdl.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