All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Double check memmap is actually valid with a memmap has unexpected holes
@ 2009-05-05  8:29 ` Mel Gorman
  0 siblings, 0 replies; 26+ messages in thread
From: Mel Gorman @ 2009-05-05  8:29 UTC (permalink / raw)
  To: akpm
  Cc: linux-mm, linux-kernel, hartleys, mcrapet, linux, fred99,
	linux-arm-kernel

pfn_valid() is meant to be able to tell if a given PFN has valid memmap
associated with it or not. In FLATMEM, it is expected that holes always
have valid memmap as long as there is valid PFNs either side of the hole.
In SPARSEMEM, it is assumed that a valid section has a memmap for the
entire section.

However, ARM and maybe other embedded architectures in the future free
memmap backing holes to save memory on the assumption the memmap is never
used. The page_zone() linkages are then broken even though pfn_valid()
returns true. A walker of the full memmap in this case must do additional
check to ensure the memmap they are looking at is sane by making sure the
zone and PFN linkages are still valid. This is expensive, but walkers of
the full memmap are extremely rare.

This was caught before for FLATMEM and hacked around but it hits again
for SPARSEMEM because the page_zone() linkages can look ok where the PFN
linkages are totally screwed. This looks like a hatchet job but the reality
is that any clean solution would end up consuming all the memory saved
by punching these unexpected holes in the memmap. For example, we tried
marking the memmap within the section invalid but the section size exceeds
the size of the hole in most cases so pfn_valid() starts returning false
where valid memmap exists. Shrinking the size of the section would increase
memory consumption offsetting the gains.

This patch identifies when an architecture is punching unexpected holes
in the memmap that the memory model cannot automatically detect. When set,
walkers of the full memmap must call memmap_valid_within() for each PFN and
passing in what it expects the page and zone to be for that PFN. If it finds
the linkages to be broken, it assumes the memmap is invalid for that PFN.

Signed-off-by: Mel Gorman <mel@csn.ul.ie>
--- 
 arch/arm/Kconfig       |    3 +--
 include/linux/mmzone.h |   26 ++++++++++++++++++++++++++
 mm/mmzone.c            |   15 +++++++++++++++
 mm/vmstat.c            |   19 ++++---------------
 4 files changed, 46 insertions(+), 17 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index e02b893..6d79051 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -925,10 +925,9 @@ config OABI_COMPAT
 	  UNPREDICTABLE (in fact it can be predicted that it won't work
 	  at all). If in doubt say Y.
 
-config ARCH_FLATMEM_HAS_HOLES
+config ARCH_HAS_HOLES_MEMORYMODEL
 	bool
 	default y
-	depends on FLATMEM
 
 # Discontigmem is deprecated
 config ARCH_DISCONTIGMEM_ENABLE
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 1ff59fd..d20513a 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -1104,6 +1104,32 @@ unsigned long __init node_memmap_size_bytes(int, unsigned long, unsigned long);
 #define pfn_valid_within(pfn) (1)
 #endif
 
+#ifdef CONFIG_ARCH_HAS_HOLES_MEMORYMODEL
+/*
+ * pfn_valid() is meant to be able to tell if a given PFN has valid memmap
+ * associated with it or not. In FLATMEM, it is expected that holes always
+ * have valid memmap as long as there is valid PFNs either side of the hole.
+ * In SPARSEMEM, it is assumed that a valid section has a memmap for the
+ * entire section.
+ *
+ * However, an ARM, and maybe other embedded architectures in the future
+ * free memmap backing holes to save memory on the assumption the memmap is
+ * never used. The page_zone linkages are then broken even though pfn_valid()
+ * returns true. A walker of the full memmap must then do this additional
+ * check to ensure the memmap they are looking at is sane by making sure
+ * the zone and PFN linkages are still valid. This is expensive, but walkers
+ * of the full memmap are extremely rare.
+ */
+int memmap_valid_within(unsigned long pfn,
+					struct page *page, struct zone *zone);
+#else
+static inline int memmap_valid_within(unsigned long pfn,
+					struct page *page, struct zone *zone)
+{
+	return 1;
+}
+#endif /* CONFIG_ARCH_HAS_HOLES_MEMORYMODEL */
+
 #endif /* !__GENERATING_BOUNDS.H */
 #endif /* !__ASSEMBLY__ */
 #endif /* _LINUX_MMZONE_H */
diff --git a/mm/mmzone.c b/mm/mmzone.c
index 16ce8b9..f5b7d17 100644
--- a/mm/mmzone.c
+++ b/mm/mmzone.c
@@ -6,6 +6,7 @@
 
 
 #include <linux/stddef.h>
+#include <linux/mm.h>
 #include <linux/mmzone.h>
 #include <linux/module.h>
 
@@ -72,3 +73,17 @@ struct zoneref *next_zones_zonelist(struct zoneref *z,
 	*zone = zonelist_zone(z);
 	return z;
 }
+
+#ifdef CONFIG_ARCH_HAS_HOLES_MEMORYMODEL
+int memmap_valid_within(unsigned long pfn,
+					struct page *page, struct zone *zone)
+{
+	if (page_to_pfn(page) != pfn)
+		return 0;
+
+	if (page_zone(page) != zone)
+		return 0;
+
+	return 1;
+}
+#endif /* CONFIG_ARCH_HAS_HOLES_MEMORYMODEL */
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 17f2abb..03ee651 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -509,22 +509,11 @@ static void pagetypeinfo_showblockcount_print(struct seq_file *m,
 			continue;
 
 		page = pfn_to_page(pfn);
-#ifdef CONFIG_ARCH_FLATMEM_HAS_HOLES
-		/*
-		 * Ordinarily, memory holes in flatmem still have a valid
-		 * memmap for the PFN range. However, an architecture for
-		 * embedded systems (e.g. ARM) can free up the memmap backing
-		 * holes to save memory on the assumption the memmap is
-		 * never used. The page_zone linkages are then broken even
-		 * though pfn_valid() returns true. Skip the page if the
-		 * linkages are broken. Even if this test passed, the impact
-		 * is that the counters for the movable type are off but
-		 * fragmentation monitoring is likely meaningless on small
-		 * systems.
-		 */
-		if (page_zone(page) != zone)
+
+		/* Watch for unexpected holes punched in the memmap */
+		if (!memmap_valid_within(pfn, page, zone))
 			continue;
-#endif
+
 		mtype = get_pageblock_migratetype(page);
 
 		if (mtype < MIGRATE_TYPES)

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH] Double check memmap is actually valid with a memmap has unexpected holes
@ 2009-05-05  8:29 ` Mel Gorman
  0 siblings, 0 replies; 26+ messages in thread
From: Mel Gorman @ 2009-05-05  8:29 UTC (permalink / raw)
  To: akpm
  Cc: linux-mm, linux-kernel, hartleys, mcrapet, linux, fred99,
	linux-arm-kernel

pfn_valid() is meant to be able to tell if a given PFN has valid memmap
associated with it or not. In FLATMEM, it is expected that holes always
have valid memmap as long as there is valid PFNs either side of the hole.
In SPARSEMEM, it is assumed that a valid section has a memmap for the
entire section.

However, ARM and maybe other embedded architectures in the future free
memmap backing holes to save memory on the assumption the memmap is never
used. The page_zone() linkages are then broken even though pfn_valid()
returns true. A walker of the full memmap in this case must do additional
check to ensure the memmap they are looking at is sane by making sure the
zone and PFN linkages are still valid. This is expensive, but walkers of
the full memmap are extremely rare.

This was caught before for FLATMEM and hacked around but it hits again
for SPARSEMEM because the page_zone() linkages can look ok where the PFN
linkages are totally screwed. This looks like a hatchet job but the reality
is that any clean solution would end up consuming all the memory saved
by punching these unexpected holes in the memmap. For example, we tried
marking the memmap within the section invalid but the section size exceeds
the size of the hole in most cases so pfn_valid() starts returning false
where valid memmap exists. Shrinking the size of the section would increase
memory consumption offsetting the gains.

This patch identifies when an architecture is punching unexpected holes
in the memmap that the memory model cannot automatically detect. When set,
walkers of the full memmap must call memmap_valid_within() for each PFN and
passing in what it expects the page and zone to be for that PFN. If it finds
the linkages to be broken, it assumes the memmap is invalid for that PFN.

Signed-off-by: Mel Gorman <mel@csn.ul.ie>
--- 
 arch/arm/Kconfig       |    3 +--
 include/linux/mmzone.h |   26 ++++++++++++++++++++++++++
 mm/mmzone.c            |   15 +++++++++++++++
 mm/vmstat.c            |   19 ++++---------------
 4 files changed, 46 insertions(+), 17 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index e02b893..6d79051 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -925,10 +925,9 @@ config OABI_COMPAT
 	  UNPREDICTABLE (in fact it can be predicted that it won't work
 	  at all). If in doubt say Y.
 
-config ARCH_FLATMEM_HAS_HOLES
+config ARCH_HAS_HOLES_MEMORYMODEL
 	bool
 	default y
-	depends on FLATMEM
 
 # Discontigmem is deprecated
 config ARCH_DISCONTIGMEM_ENABLE
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 1ff59fd..d20513a 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -1104,6 +1104,32 @@ unsigned long __init node_memmap_size_bytes(int, unsigned long, unsigned long);
 #define pfn_valid_within(pfn) (1)
 #endif
 
+#ifdef CONFIG_ARCH_HAS_HOLES_MEMORYMODEL
+/*
+ * pfn_valid() is meant to be able to tell if a given PFN has valid memmap
+ * associated with it or not. In FLATMEM, it is expected that holes always
+ * have valid memmap as long as there is valid PFNs either side of the hole.
+ * In SPARSEMEM, it is assumed that a valid section has a memmap for the
+ * entire section.
+ *
+ * However, an ARM, and maybe other embedded architectures in the future
+ * free memmap backing holes to save memory on the assumption the memmap is
+ * never used. The page_zone linkages are then broken even though pfn_valid()
+ * returns true. A walker of the full memmap must then do this additional
+ * check to ensure the memmap they are looking at is sane by making sure
+ * the zone and PFN linkages are still valid. This is expensive, but walkers
+ * of the full memmap are extremely rare.
+ */
+int memmap_valid_within(unsigned long pfn,
+					struct page *page, struct zone *zone);
+#else
+static inline int memmap_valid_within(unsigned long pfn,
+					struct page *page, struct zone *zone)
+{
+	return 1;
+}
+#endif /* CONFIG_ARCH_HAS_HOLES_MEMORYMODEL */
+
 #endif /* !__GENERATING_BOUNDS.H */
 #endif /* !__ASSEMBLY__ */
 #endif /* _LINUX_MMZONE_H */
diff --git a/mm/mmzone.c b/mm/mmzone.c
index 16ce8b9..f5b7d17 100644
--- a/mm/mmzone.c
+++ b/mm/mmzone.c
@@ -6,6 +6,7 @@
 
 
 #include <linux/stddef.h>
+#include <linux/mm.h>
 #include <linux/mmzone.h>
 #include <linux/module.h>
 
@@ -72,3 +73,17 @@ struct zoneref *next_zones_zonelist(struct zoneref *z,
 	*zone = zonelist_zone(z);
 	return z;
 }
+
+#ifdef CONFIG_ARCH_HAS_HOLES_MEMORYMODEL
+int memmap_valid_within(unsigned long pfn,
+					struct page *page, struct zone *zone)
+{
+	if (page_to_pfn(page) != pfn)
+		return 0;
+
+	if (page_zone(page) != zone)
+		return 0;
+
+	return 1;
+}
+#endif /* CONFIG_ARCH_HAS_HOLES_MEMORYMODEL */
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 17f2abb..03ee651 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -509,22 +509,11 @@ static void pagetypeinfo_showblockcount_print(struct seq_file *m,
 			continue;
 
 		page = pfn_to_page(pfn);
-#ifdef CONFIG_ARCH_FLATMEM_HAS_HOLES
-		/*
-		 * Ordinarily, memory holes in flatmem still have a valid
-		 * memmap for the PFN range. However, an architecture for
-		 * embedded systems (e.g. ARM) can free up the memmap backing
-		 * holes to save memory on the assumption the memmap is
-		 * never used. The page_zone linkages are then broken even
-		 * though pfn_valid() returns true. Skip the page if the
-		 * linkages are broken. Even if this test passed, the impact
-		 * is that the counters for the movable type are off but
-		 * fragmentation monitoring is likely meaningless on small
-		 * systems.
-		 */
-		if (page_zone(page) != zone)
+
+		/* Watch for unexpected holes punched in the memmap */
+		if (!memmap_valid_within(pfn, page, zone))
 			continue;
-#endif
+
 		mtype = get_pageblock_migratetype(page);
 
 		if (mtype < MIGRATE_TYPES)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH] Double check memmap is actually valid with a memmap has unexpected holes
  2009-05-05  8:29 ` Mel Gorman
@ 2009-05-05  8:36   ` Russell King - ARM Linux
  -1 siblings, 0 replies; 26+ messages in thread
From: Russell King - ARM Linux @ 2009-05-05  8:36 UTC (permalink / raw)
  To: Mel Gorman
  Cc: akpm, linux-mm, linux-kernel, hartleys, mcrapet, fred99,
	linux-arm-kernel

On Tue, May 05, 2009 at 09:29:44AM +0100, Mel Gorman wrote:
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index e02b893..6d79051 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -925,10 +925,9 @@ config OABI_COMPAT
>  	  UNPREDICTABLE (in fact it can be predicted that it won't work
>  	  at all). If in doubt say Y.
>  
> -config ARCH_FLATMEM_HAS_HOLES
> +config ARCH_HAS_HOLES_MEMORYMODEL

Can we arrange for EP93xx to select this so we don't have it enabled for
everyone.

The other user of this was RPC when it was flatmem only, but since it has
been converted to sparsemem it's no longer an issue there.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] Double check memmap is actually valid with a memmap has unexpected holes
@ 2009-05-05  8:36   ` Russell King - ARM Linux
  0 siblings, 0 replies; 26+ messages in thread
From: Russell King - ARM Linux @ 2009-05-05  8:36 UTC (permalink / raw)
  To: Mel Gorman
  Cc: akpm, linux-mm, linux-kernel, hartleys, mcrapet, fred99,
	linux-arm-kernel

On Tue, May 05, 2009 at 09:29:44AM +0100, Mel Gorman wrote:
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index e02b893..6d79051 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -925,10 +925,9 @@ config OABI_COMPAT
>  	  UNPREDICTABLE (in fact it can be predicted that it won't work
>  	  at all). If in doubt say Y.
>  
> -config ARCH_FLATMEM_HAS_HOLES
> +config ARCH_HAS_HOLES_MEMORYMODEL

Can we arrange for EP93xx to select this so we don't have it enabled for
everyone.

The other user of this was RPC when it was flatmem only, but since it has
been converted to sparsemem it's no longer an issue there.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] Double check memmap is actually valid with a memmap has unexpected holes
  2009-05-05  8:36   ` Russell King - ARM Linux
@ 2009-05-05  8:49     ` Mel Gorman
  -1 siblings, 0 replies; 26+ messages in thread
From: Mel Gorman @ 2009-05-05  8:49 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: akpm, linux-mm, linux-kernel, hartleys, mcrapet, fred99,
	linux-arm-kernel

On Tue, May 05, 2009 at 09:36:14AM +0100, Russell King - ARM Linux wrote:
> On Tue, May 05, 2009 at 09:29:44AM +0100, Mel Gorman wrote:
> > diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> > index e02b893..6d79051 100644
> > --- a/arch/arm/Kconfig
> > +++ b/arch/arm/Kconfig
> > @@ -925,10 +925,9 @@ config OABI_COMPAT
> >  	  UNPREDICTABLE (in fact it can be predicted that it won't work
> >  	  at all). If in doubt say Y.
> >  
> > -config ARCH_FLATMEM_HAS_HOLES
> > +config ARCH_HAS_HOLES_MEMORYMODEL
> 
> Can we arrange for EP93xx to select this so we don't have it enabled for
> everyone.
> 
> The other user of this was RPC when it was flatmem only, but since it has
> been converted to sparsemem it's no longer an issue there.
> 

This problem is hitting SPARSEMEM, at least according to reports I have
been cc'd on so it's not a SPARSEMEM vs FLATMEM thing. From the leader --
"This was caught before for FLATMEM and hacked around but it hits again for
SPARSEMEM because the page_zone linkages can look ok where the PFN linkages
are totally screwed."

If you feel that this problem is only encountered on the EP93xx, then the
option could be made more conservative with the following (untested) patch
and then wait to see who complains.

==== CUT HERE ====

arm: Only select ARCH_HAS_HOLES_MEMORYMODEL on the EP93xx

ARM frees unused memmap to save memory but this can collide with the core
VM's view of the memory model when walking what it views to be valid PFNs in
the system. ARM selects ARCH_HAS_HOLES_MEMORYMODEL for all architectures to
double check the memmap being examined is valid but it has been asserted
that this may only be needed on EP93xx in practice. This patch selects
ARCH_HAS_HOLES_MEMORYMODEL only for that sub-architecture.

Signed-off-by: Mel Gorman <mel@csn.ul.ie>
--- 
 arch/arm/Kconfig |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 6d79051..a4c195c 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -273,6 +273,7 @@ config ARCH_EP93XX
 	select HAVE_CLK
 	select COMMON_CLKDEV
 	select ARCH_REQUIRE_GPIOLIB
+	select ARCH_HAS_HOLES_MEMORYMODEL
 	help
 	  This enables support for the Cirrus EP93xx series of CPUs.
 
@@ -927,7 +928,7 @@ config OABI_COMPAT
 
 config ARCH_HAS_HOLES_MEMORYMODEL
 	bool
-	default y
+	default n
 
 # Discontigmem is deprecated
 config ARCH_DISCONTIGMEM_ENABLE

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH] Double check memmap is actually valid with a memmap has unexpected holes
@ 2009-05-05  8:49     ` Mel Gorman
  0 siblings, 0 replies; 26+ messages in thread
From: Mel Gorman @ 2009-05-05  8:49 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: akpm, linux-mm, linux-kernel, hartleys, mcrapet, fred99,
	linux-arm-kernel

On Tue, May 05, 2009 at 09:36:14AM +0100, Russell King - ARM Linux wrote:
> On Tue, May 05, 2009 at 09:29:44AM +0100, Mel Gorman wrote:
> > diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> > index e02b893..6d79051 100644
> > --- a/arch/arm/Kconfig
> > +++ b/arch/arm/Kconfig
> > @@ -925,10 +925,9 @@ config OABI_COMPAT
> >  	  UNPREDICTABLE (in fact it can be predicted that it won't work
> >  	  at all). If in doubt say Y.
> >  
> > -config ARCH_FLATMEM_HAS_HOLES
> > +config ARCH_HAS_HOLES_MEMORYMODEL
> 
> Can we arrange for EP93xx to select this so we don't have it enabled for
> everyone.
> 
> The other user of this was RPC when it was flatmem only, but since it has
> been converted to sparsemem it's no longer an issue there.
> 

This problem is hitting SPARSEMEM, at least according to reports I have
been cc'd on so it's not a SPARSEMEM vs FLATMEM thing. From the leader --
"This was caught before for FLATMEM and hacked around but it hits again for
SPARSEMEM because the page_zone linkages can look ok where the PFN linkages
are totally screwed."

If you feel that this problem is only encountered on the EP93xx, then the
option could be made more conservative with the following (untested) patch
and then wait to see who complains.

==== CUT HERE ====

arm: Only select ARCH_HAS_HOLES_MEMORYMODEL on the EP93xx

ARM frees unused memmap to save memory but this can collide with the core
VM's view of the memory model when walking what it views to be valid PFNs in
the system. ARM selects ARCH_HAS_HOLES_MEMORYMODEL for all architectures to
double check the memmap being examined is valid but it has been asserted
that this may only be needed on EP93xx in practice. This patch selects
ARCH_HAS_HOLES_MEMORYMODEL only for that sub-architecture.

Signed-off-by: Mel Gorman <mel@csn.ul.ie>
--- 
 arch/arm/Kconfig |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 6d79051..a4c195c 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -273,6 +273,7 @@ config ARCH_EP93XX
 	select HAVE_CLK
 	select COMMON_CLKDEV
 	select ARCH_REQUIRE_GPIOLIB
+	select ARCH_HAS_HOLES_MEMORYMODEL
 	help
 	  This enables support for the Cirrus EP93xx series of CPUs.
 
@@ -927,7 +928,7 @@ config OABI_COMPAT
 
 config ARCH_HAS_HOLES_MEMORYMODEL
 	bool
-	default y
+	default n
 
 # Discontigmem is deprecated
 config ARCH_DISCONTIGMEM_ENABLE

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH] Double check memmap is actually valid with a memmap has unexpected holes
  2009-05-05  8:29 ` Mel Gorman
@ 2009-05-05 11:06   ` Johannes Weiner
  -1 siblings, 0 replies; 26+ messages in thread
From: Johannes Weiner @ 2009-05-05 11:06 UTC (permalink / raw)
  To: Mel Gorman
  Cc: akpm, linux-mm, linux-kernel, hartleys, mcrapet, linux, fred99,
	linux-arm-kernel

Hi Mel,

On Tue, May 05, 2009 at 09:29:44AM +0100, Mel Gorman wrote:
> pfn_valid() is meant to be able to tell if a given PFN has valid memmap
> associated with it or not. In FLATMEM, it is expected that holes always
> have valid memmap as long as there is valid PFNs either side of the hole.
> In SPARSEMEM, it is assumed that a valid section has a memmap for the
> entire section.
> 
> However, ARM and maybe other embedded architectures in the future free
> memmap backing holes to save memory on the assumption the memmap is never
> used. The page_zone() linkages are then broken even though pfn_valid()
> returns true. A walker of the full memmap in this case must do additional
> check to ensure the memmap they are looking at is sane by making sure the
> zone and PFN linkages are still valid. This is expensive, but walkers of
> the full memmap are extremely rare.
> 
> This was caught before for FLATMEM and hacked around but it hits again
> for SPARSEMEM because the page_zone() linkages can look ok where the PFN
> linkages are totally screwed. This looks like a hatchet job but the reality
> is that any clean solution would end up consuming all the memory saved
> by punching these unexpected holes in the memmap. For example, we tried
> marking the memmap within the section invalid but the section size exceeds
> the size of the hole in most cases so pfn_valid() starts returning false
> where valid memmap exists. Shrinking the size of the section would increase
> memory consumption offsetting the gains.
> 
> This patch identifies when an architecture is punching unexpected holes
> in the memmap that the memory model cannot automatically detect. When set,
> walkers of the full memmap must call memmap_valid_within() for each PFN and
> passing in what it expects the page and zone to be for that PFN. If it finds
> the linkages to be broken, it assumes the memmap is invalid for that PFN.
> 
> Signed-off-by: Mel Gorman <mel@csn.ul.ie>

I think we also need to fix up show_mem().  Attached is a
compile-tested patch, please have a look.  I am not sure about memory
hotplug issues but on a quick glance the vmstat stuff seems to be
optimistic as well.

---
From: Johannes Weiner <hannes@cmpxchg.org>
Subject: lib: adjust show_mem() to support memmap holes

Some architectures free the backing of mem_map holes.  pfn_valid() is
not able to report this properly, so a stronger check is needed if the
caller is about to use the page descriptor derived from a pfn.

Change the node walking to zone walking and use memmap_valid_within()
to check for holes.  This is reliable as it additionally checks for
page_zone() and page_to_pfn() coherency.

Not-yet-signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
---
 lib/show_mem.c |   21 +++++++++------------
 1 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/lib/show_mem.c b/lib/show_mem.c
index 238e72a..ed3c3ec 100644
--- a/lib/show_mem.c
+++ b/lib/show_mem.c
@@ -11,29 +11,27 @@
 
 void show_mem(void)
 {
-	pg_data_t *pgdat;
 	unsigned long total = 0, reserved = 0, shared = 0,
 		nonshared = 0, highmem = 0;
+	struct zone *zone;
 
 	printk(KERN_INFO "Mem-Info:\n");
 	show_free_areas();
 
-	for_each_online_pgdat(pgdat) {
-		unsigned long i, flags;
+	for_each_populated_zone(zone) {
+		unsigned long start = zone->zone_start_pfn;
+		unsigned long end = start + zone->spanned_pages;
+		unsigned long pfn;
 
-		pgdat_resize_lock(pgdat, &flags);
-		for (i = 0; i < pgdat->node_spanned_pages; i++) {
-			struct page *page;
-			unsigned long pfn = pgdat->node_start_pfn + i;
+		for (pfn = start; pfn < end; pfn++) {
+			struct page *page = pfn_to_page(pfn);
 
-			if (unlikely(!(i % MAX_ORDER_NR_PAGES)))
+			if (unlikely(!(pfn % MAX_ORDER_NR_PAGES)))
 				touch_nmi_watchdog();
 
-			if (!pfn_valid(pfn))
+			if (!memmap_valid_within(pfn, page, zone))
 				continue;
 
-			page = pfn_to_page(pfn);
-
 			if (PageHighMem(page))
 				highmem++;
 
@@ -46,7 +44,6 @@ void show_mem(void)
 
 			total++;
 		}
-		pgdat_resize_unlock(pgdat, &flags);
 	}
 
 	printk(KERN_INFO "%lu pages RAM\n", total);
-- 
1.6.2.1.135.gde769


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH] Double check memmap is actually valid with a memmap has unexpected holes
@ 2009-05-05 11:06   ` Johannes Weiner
  0 siblings, 0 replies; 26+ messages in thread
From: Johannes Weiner @ 2009-05-05 11:06 UTC (permalink / raw)
  To: Mel Gorman
  Cc: akpm, linux-mm, linux-kernel, hartleys, mcrapet, linux, fred99,
	linux-arm-kernel

Hi Mel,

On Tue, May 05, 2009 at 09:29:44AM +0100, Mel Gorman wrote:
> pfn_valid() is meant to be able to tell if a given PFN has valid memmap
> associated with it or not. In FLATMEM, it is expected that holes always
> have valid memmap as long as there is valid PFNs either side of the hole.
> In SPARSEMEM, it is assumed that a valid section has a memmap for the
> entire section.
> 
> However, ARM and maybe other embedded architectures in the future free
> memmap backing holes to save memory on the assumption the memmap is never
> used. The page_zone() linkages are then broken even though pfn_valid()
> returns true. A walker of the full memmap in this case must do additional
> check to ensure the memmap they are looking at is sane by making sure the
> zone and PFN linkages are still valid. This is expensive, but walkers of
> the full memmap are extremely rare.
> 
> This was caught before for FLATMEM and hacked around but it hits again
> for SPARSEMEM because the page_zone() linkages can look ok where the PFN
> linkages are totally screwed. This looks like a hatchet job but the reality
> is that any clean solution would end up consuming all the memory saved
> by punching these unexpected holes in the memmap. For example, we tried
> marking the memmap within the section invalid but the section size exceeds
> the size of the hole in most cases so pfn_valid() starts returning false
> where valid memmap exists. Shrinking the size of the section would increase
> memory consumption offsetting the gains.
> 
> This patch identifies when an architecture is punching unexpected holes
> in the memmap that the memory model cannot automatically detect. When set,
> walkers of the full memmap must call memmap_valid_within() for each PFN and
> passing in what it expects the page and zone to be for that PFN. If it finds
> the linkages to be broken, it assumes the memmap is invalid for that PFN.
> 
> Signed-off-by: Mel Gorman <mel@csn.ul.ie>

I think we also need to fix up show_mem().  Attached is a
compile-tested patch, please have a look.  I am not sure about memory
hotplug issues but on a quick glance the vmstat stuff seems to be
optimistic as well.

---
From: Johannes Weiner <hannes@cmpxchg.org>
Subject: lib: adjust show_mem() to support memmap holes

Some architectures free the backing of mem_map holes.  pfn_valid() is
not able to report this properly, so a stronger check is needed if the
caller is about to use the page descriptor derived from a pfn.

Change the node walking to zone walking and use memmap_valid_within()
to check for holes.  This is reliable as it additionally checks for
page_zone() and page_to_pfn() coherency.

Not-yet-signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
---
 lib/show_mem.c |   21 +++++++++------------
 1 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/lib/show_mem.c b/lib/show_mem.c
index 238e72a..ed3c3ec 100644
--- a/lib/show_mem.c
+++ b/lib/show_mem.c
@@ -11,29 +11,27 @@
 
 void show_mem(void)
 {
-	pg_data_t *pgdat;
 	unsigned long total = 0, reserved = 0, shared = 0,
 		nonshared = 0, highmem = 0;
+	struct zone *zone;
 
 	printk(KERN_INFO "Mem-Info:\n");
 	show_free_areas();
 
-	for_each_online_pgdat(pgdat) {
-		unsigned long i, flags;
+	for_each_populated_zone(zone) {
+		unsigned long start = zone->zone_start_pfn;
+		unsigned long end = start + zone->spanned_pages;
+		unsigned long pfn;
 
-		pgdat_resize_lock(pgdat, &flags);
-		for (i = 0; i < pgdat->node_spanned_pages; i++) {
-			struct page *page;
-			unsigned long pfn = pgdat->node_start_pfn + i;
+		for (pfn = start; pfn < end; pfn++) {
+			struct page *page = pfn_to_page(pfn);
 
-			if (unlikely(!(i % MAX_ORDER_NR_PAGES)))
+			if (unlikely(!(pfn % MAX_ORDER_NR_PAGES)))
 				touch_nmi_watchdog();
 
-			if (!pfn_valid(pfn))
+			if (!memmap_valid_within(pfn, page, zone))
 				continue;
 
-			page = pfn_to_page(pfn);
-
 			if (PageHighMem(page))
 				highmem++;
 
@@ -46,7 +44,6 @@ void show_mem(void)
 
 			total++;
 		}
-		pgdat_resize_unlock(pgdat, &flags);
 	}
 
 	printk(KERN_INFO "%lu pages RAM\n", total);
-- 
1.6.2.1.135.gde769

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH] Double check memmap is actually valid with a memmap has unexpected holes
  2009-05-05 11:06   ` Johannes Weiner
@ 2009-05-06 14:31     ` Mel Gorman
  -1 siblings, 0 replies; 26+ messages in thread
From: Mel Gorman @ 2009-05-06 14:31 UTC (permalink / raw)
  To: Johannes Weiner
  Cc: akpm, linux-mm, linux-kernel, hartleys, mcrapet, linux, fred99,
	linux-arm-kernel

On Tue, May 05, 2009 at 01:06:53PM +0200, Johannes Weiner wrote:
> Hi Mel,
> 
> On Tue, May 05, 2009 at 09:29:44AM +0100, Mel Gorman wrote:
> > pfn_valid() is meant to be able to tell if a given PFN has valid memmap
> > associated with it or not. In FLATMEM, it is expected that holes always
> > have valid memmap as long as there is valid PFNs either side of the hole.
> > In SPARSEMEM, it is assumed that a valid section has a memmap for the
> > entire section.
> > 
> > However, ARM and maybe other embedded architectures in the future free
> > memmap backing holes to save memory on the assumption the memmap is never
> > used. The page_zone() linkages are then broken even though pfn_valid()
> > returns true. A walker of the full memmap in this case must do additional
> > check to ensure the memmap they are looking at is sane by making sure the
> > zone and PFN linkages are still valid. This is expensive, but walkers of
> > the full memmap are extremely rare.
> > 
> > This was caught before for FLATMEM and hacked around but it hits again
> > for SPARSEMEM because the page_zone() linkages can look ok where the PFN
> > linkages are totally screwed. This looks like a hatchet job but the reality
> > is that any clean solution would end up consuming all the memory saved
> > by punching these unexpected holes in the memmap. For example, we tried
> > marking the memmap within the section invalid but the section size exceeds
> > the size of the hole in most cases so pfn_valid() starts returning false
> > where valid memmap exists. Shrinking the size of the section would increase
> > memory consumption offsetting the gains.
> > 
> > This patch identifies when an architecture is punching unexpected holes
> > in the memmap that the memory model cannot automatically detect. When set,
> > walkers of the full memmap must call memmap_valid_within() for each PFN and
> > passing in what it expects the page and zone to be for that PFN. If it finds
> > the linkages to be broken, it assumes the memmap is invalid for that PFN.
> > 
> > Signed-off-by: Mel Gorman <mel@csn.ul.ie>
> 
> I think we also need to fix up show_mem(). 

As it turns out, ARM has its own show_mem(). I don't see how, but ARM
must not be using lib/show_mem.c even though it compiles it.

> Attached is a
> compile-tested patch, please have a look.  I am not sure about memory
> hotplug issues but on a quick glance the vmstat stuff seems to be
> optimistic as well.
> 
> ---
> From: Johannes Weiner <hannes@cmpxchg.org>
> Subject: lib: adjust show_mem() to support memmap holes
> 
> Some architectures free the backing of mem_map holes.  pfn_valid() is
> not able to report this properly, so a stronger check is needed if the
> caller is about to use the page descriptor derived from a pfn.
> 
> Change the node walking to zone walking and use memmap_valid_within()
> to check for holes.  This is reliable as it additionally checks for
> page_zone() and page_to_pfn() coherency.
> 
> Not-yet-signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
> ---
>  lib/show_mem.c |   21 +++++++++------------
>  1 files changed, 9 insertions(+), 12 deletions(-)
> 
> diff --git a/lib/show_mem.c b/lib/show_mem.c
> index 238e72a..ed3c3ec 100644
> --- a/lib/show_mem.c
> +++ b/lib/show_mem.c
> @@ -11,29 +11,27 @@
>  
>  void show_mem(void)
>  {
> -	pg_data_t *pgdat;
>  	unsigned long total = 0, reserved = 0, shared = 0,
>  		nonshared = 0, highmem = 0;
> +	struct zone *zone;
>  
>  	printk(KERN_INFO "Mem-Info:\n");
>  	show_free_areas();
>  
> -	for_each_online_pgdat(pgdat) {
> -		unsigned long i, flags;
> +	for_each_populated_zone(zone) {
> +		unsigned long start = zone->zone_start_pfn;
> +		unsigned long end = start + zone->spanned_pages;

The patch appears to be doing two things

o Scanning zones instead of pgdats
o Adding the use of memmap_valid_within()

Scanning zones instead of pgdats seems like a good idea on its own and should
be split out for separate consideration.

> +		unsigned long pfn;
>  
> -		pgdat_resize_lock(pgdat, &flags);

How sure are you about removing the acquisition of this lock?  If anything,
it appears that pagetypeinfo_showblockcount_print() should be taking this lock.

> -		for (i = 0; i < pgdat->node_spanned_pages; i++) {
> -			struct page *page;
> -			unsigned long pfn = pgdat->node_start_pfn + i;
> +		for (pfn = start; pfn < end; pfn++) {
> +			struct page *page = pfn_to_page(pfn);
>  

You need to check pfn_valid() before using pfn_to_page().

> -			if (unlikely(!(i % MAX_ORDER_NR_PAGES)))
> +			if (unlikely(!(pfn % MAX_ORDER_NR_PAGES)))
>  				touch_nmi_watchdog();
>  
> -			if (!pfn_valid(pfn))
> +			if (!memmap_valid_within(pfn, page, zone))
>  				continue;
>  

You need both the pfn_valid() check and the memmap_valid_within() as
memmap_valid_within() unconditionally returns 1 for most architectures. If
you applied this patch as-is, memory holes in a zone will cause big problems -
random results at best and invalid memory references at worst.

> -			page = pfn_to_page(pfn);
> -
>  			if (PageHighMem(page))
>  				highmem++;
>  
> @@ -46,7 +44,6 @@ void show_mem(void)
>  
>  			total++;
>  		}
> -		pgdat_resize_unlock(pgdat, &flags);
>  	}
>  
>  	printk(KERN_INFO "%lu pages RAM\n", total);
> -- 
> 1.6.2.1.135.gde769
> 

-- 
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] Double check memmap is actually valid with a memmap has unexpected holes
@ 2009-05-06 14:31     ` Mel Gorman
  0 siblings, 0 replies; 26+ messages in thread
From: Mel Gorman @ 2009-05-06 14:31 UTC (permalink / raw)
  To: Johannes Weiner
  Cc: akpm, linux-mm, linux-kernel, hartleys, mcrapet, linux, fred99,
	linux-arm-kernel

On Tue, May 05, 2009 at 01:06:53PM +0200, Johannes Weiner wrote:
> Hi Mel,
> 
> On Tue, May 05, 2009 at 09:29:44AM +0100, Mel Gorman wrote:
> > pfn_valid() is meant to be able to tell if a given PFN has valid memmap
> > associated with it or not. In FLATMEM, it is expected that holes always
> > have valid memmap as long as there is valid PFNs either side of the hole.
> > In SPARSEMEM, it is assumed that a valid section has a memmap for the
> > entire section.
> > 
> > However, ARM and maybe other embedded architectures in the future free
> > memmap backing holes to save memory on the assumption the memmap is never
> > used. The page_zone() linkages are then broken even though pfn_valid()
> > returns true. A walker of the full memmap in this case must do additional
> > check to ensure the memmap they are looking at is sane by making sure the
> > zone and PFN linkages are still valid. This is expensive, but walkers of
> > the full memmap are extremely rare.
> > 
> > This was caught before for FLATMEM and hacked around but it hits again
> > for SPARSEMEM because the page_zone() linkages can look ok where the PFN
> > linkages are totally screwed. This looks like a hatchet job but the reality
> > is that any clean solution would end up consuming all the memory saved
> > by punching these unexpected holes in the memmap. For example, we tried
> > marking the memmap within the section invalid but the section size exceeds
> > the size of the hole in most cases so pfn_valid() starts returning false
> > where valid memmap exists. Shrinking the size of the section would increase
> > memory consumption offsetting the gains.
> > 
> > This patch identifies when an architecture is punching unexpected holes
> > in the memmap that the memory model cannot automatically detect. When set,
> > walkers of the full memmap must call memmap_valid_within() for each PFN and
> > passing in what it expects the page and zone to be for that PFN. If it finds
> > the linkages to be broken, it assumes the memmap is invalid for that PFN.
> > 
> > Signed-off-by: Mel Gorman <mel@csn.ul.ie>
> 
> I think we also need to fix up show_mem(). 

As it turns out, ARM has its own show_mem(). I don't see how, but ARM
must not be using lib/show_mem.c even though it compiles it.

> Attached is a
> compile-tested patch, please have a look.  I am not sure about memory
> hotplug issues but on a quick glance the vmstat stuff seems to be
> optimistic as well.
> 
> ---
> From: Johannes Weiner <hannes@cmpxchg.org>
> Subject: lib: adjust show_mem() to support memmap holes
> 
> Some architectures free the backing of mem_map holes.  pfn_valid() is
> not able to report this properly, so a stronger check is needed if the
> caller is about to use the page descriptor derived from a pfn.
> 
> Change the node walking to zone walking and use memmap_valid_within()
> to check for holes.  This is reliable as it additionally checks for
> page_zone() and page_to_pfn() coherency.
> 
> Not-yet-signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
> ---
>  lib/show_mem.c |   21 +++++++++------------
>  1 files changed, 9 insertions(+), 12 deletions(-)
> 
> diff --git a/lib/show_mem.c b/lib/show_mem.c
> index 238e72a..ed3c3ec 100644
> --- a/lib/show_mem.c
> +++ b/lib/show_mem.c
> @@ -11,29 +11,27 @@
>  
>  void show_mem(void)
>  {
> -	pg_data_t *pgdat;
>  	unsigned long total = 0, reserved = 0, shared = 0,
>  		nonshared = 0, highmem = 0;
> +	struct zone *zone;
>  
>  	printk(KERN_INFO "Mem-Info:\n");
>  	show_free_areas();
>  
> -	for_each_online_pgdat(pgdat) {
> -		unsigned long i, flags;
> +	for_each_populated_zone(zone) {
> +		unsigned long start = zone->zone_start_pfn;
> +		unsigned long end = start + zone->spanned_pages;

The patch appears to be doing two things

o Scanning zones instead of pgdats
o Adding the use of memmap_valid_within()

Scanning zones instead of pgdats seems like a good idea on its own and should
be split out for separate consideration.

> +		unsigned long pfn;
>  
> -		pgdat_resize_lock(pgdat, &flags);

How sure are you about removing the acquisition of this lock?  If anything,
it appears that pagetypeinfo_showblockcount_print() should be taking this lock.

> -		for (i = 0; i < pgdat->node_spanned_pages; i++) {
> -			struct page *page;
> -			unsigned long pfn = pgdat->node_start_pfn + i;
> +		for (pfn = start; pfn < end; pfn++) {
> +			struct page *page = pfn_to_page(pfn);
>  

You need to check pfn_valid() before using pfn_to_page().

> -			if (unlikely(!(i % MAX_ORDER_NR_PAGES)))
> +			if (unlikely(!(pfn % MAX_ORDER_NR_PAGES)))
>  				touch_nmi_watchdog();
>  
> -			if (!pfn_valid(pfn))
> +			if (!memmap_valid_within(pfn, page, zone))
>  				continue;
>  

You need both the pfn_valid() check and the memmap_valid_within() as
memmap_valid_within() unconditionally returns 1 for most architectures. If
you applied this patch as-is, memory holes in a zone will cause big problems -
random results at best and invalid memory references at worst.

> -			page = pfn_to_page(pfn);
> -
>  			if (PageHighMem(page))
>  				highmem++;
>  
> @@ -46,7 +44,6 @@ void show_mem(void)
>  
>  			total++;
>  		}
> -		pgdat_resize_unlock(pgdat, &flags);
>  	}
>  
>  	printk(KERN_INFO "%lu pages RAM\n", total);
> -- 
> 1.6.2.1.135.gde769
> 

-- 
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] Double check memmap is actually valid with a memmap has unexpected holes
  2009-05-06 14:31     ` Mel Gorman
@ 2009-05-06 15:50       ` Johannes Weiner
  -1 siblings, 0 replies; 26+ messages in thread
From: Johannes Weiner @ 2009-05-06 15:50 UTC (permalink / raw)
  To: Mel Gorman
  Cc: akpm, linux-mm, linux-kernel, hartleys, mcrapet, linux, fred99,
	linux-arm-kernel, Badari Pulavarty, Yasunori Goto

On Wed, May 06, 2009 at 03:31:00PM +0100, Mel Gorman wrote:
> On Tue, May 05, 2009 at 01:06:53PM +0200, Johannes Weiner wrote:
> > Hi Mel,
> > 
> > On Tue, May 05, 2009 at 09:29:44AM +0100, Mel Gorman wrote:
> > > pfn_valid() is meant to be able to tell if a given PFN has valid memmap
> > > associated with it or not. In FLATMEM, it is expected that holes always
> > > have valid memmap as long as there is valid PFNs either side of the hole.
> > > In SPARSEMEM, it is assumed that a valid section has a memmap for the
> > > entire section.
> > > 
> > > However, ARM and maybe other embedded architectures in the future free
> > > memmap backing holes to save memory on the assumption the memmap is never
> > > used. The page_zone() linkages are then broken even though pfn_valid()
> > > returns true. A walker of the full memmap in this case must do additional
> > > check to ensure the memmap they are looking at is sane by making sure the
> > > zone and PFN linkages are still valid. This is expensive, but walkers of
> > > the full memmap are extremely rare.
> > > 
> > > This was caught before for FLATMEM and hacked around but it hits again
> > > for SPARSEMEM because the page_zone() linkages can look ok where the PFN
> > > linkages are totally screwed. This looks like a hatchet job but the reality
> > > is that any clean solution would end up consuming all the memory saved
> > > by punching these unexpected holes in the memmap. For example, we tried
> > > marking the memmap within the section invalid but the section size exceeds
> > > the size of the hole in most cases so pfn_valid() starts returning false
> > > where valid memmap exists. Shrinking the size of the section would increase
> > > memory consumption offsetting the gains.
> > > 
> > > This patch identifies when an architecture is punching unexpected holes
> > > in the memmap that the memory model cannot automatically detect. When set,
> > > walkers of the full memmap must call memmap_valid_within() for each PFN and
> > > passing in what it expects the page and zone to be for that PFN. If it finds
> > > the linkages to be broken, it assumes the memmap is invalid for that PFN.
> > > 
> > > Signed-off-by: Mel Gorman <mel@csn.ul.ie>
> > 
> > I think we also need to fix up show_mem(). 
> 
> As it turns out, ARM has its own show_mem(). I don't see how, but ARM
> must not be using lib/show_mem.c even though it compiles it.

It's some linker magic for lib/.  It compiles both but treats the
library version as weak symbol (or something).

But with the zone-walking show_mem, I think it should be able to use
the generic version.

> > Attached is a
> > compile-tested patch, please have a look.  I am not sure about memory
> > hotplug issues but on a quick glance the vmstat stuff seems to be
> > optimistic as well.
> > 
> > ---
> > From: Johannes Weiner <hannes@cmpxchg.org>
> > Subject: lib: adjust show_mem() to support memmap holes
> > 
> > Some architectures free the backing of mem_map holes.  pfn_valid() is
> > not able to report this properly, so a stronger check is needed if the
> > caller is about to use the page descriptor derived from a pfn.
> > 
> > Change the node walking to zone walking and use memmap_valid_within()
> > to check for holes.  This is reliable as it additionally checks for
> > page_zone() and page_to_pfn() coherency.
> > 
> > Not-yet-signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
> > ---
> >  lib/show_mem.c |   21 +++++++++------------
> >  1 files changed, 9 insertions(+), 12 deletions(-)
> > 
> > diff --git a/lib/show_mem.c b/lib/show_mem.c
> > index 238e72a..ed3c3ec 100644
> > --- a/lib/show_mem.c
> > +++ b/lib/show_mem.c
> > @@ -11,29 +11,27 @@
> >  
> >  void show_mem(void)
> >  {
> > -	pg_data_t *pgdat;
> >  	unsigned long total = 0, reserved = 0, shared = 0,
> >  		nonshared = 0, highmem = 0;
> > +	struct zone *zone;
> >  
> >  	printk(KERN_INFO "Mem-Info:\n");
> >  	show_free_areas();
> >  
> > -	for_each_online_pgdat(pgdat) {
> > -		unsigned long i, flags;
> > +	for_each_populated_zone(zone) {
> > +		unsigned long start = zone->zone_start_pfn;
> > +		unsigned long end = start + zone->spanned_pages;
> 
> The patch appears to be doing two things
> 
> o Scanning zones instead of pgdats
> o Adding the use of memmap_valid_within()
> 
> Scanning zones instead of pgdats seems like a good idea on its own and should
> be split out for separate consideration.

Good idea.  Will do.

> > +		unsigned long pfn;
> >  
> > -		pgdat_resize_lock(pgdat, &flags);
> 
> How sure are you about removing the acquisition of this lock?  If anything,
> it appears that pagetypeinfo_showblockcount_print() should be taking this lock.

I'm completely unsure about it.

<adds memory hotplug guys to CC>

> > -		for (i = 0; i < pgdat->node_spanned_pages; i++) {
> > -			struct page *page;
> > -			unsigned long pfn = pgdat->node_start_pfn + i;
> > +		for (pfn = start; pfn < end; pfn++) {
> > +			struct page *page = pfn_to_page(pfn);
> >  
> 
> You need to check pfn_valid() before using pfn_to_page().
> 
> > -			if (unlikely(!(i % MAX_ORDER_NR_PAGES)))
> > +			if (unlikely(!(pfn % MAX_ORDER_NR_PAGES)))
> >  				touch_nmi_watchdog();
> >  
> > -			if (!pfn_valid(pfn))
> > +			if (!memmap_valid_within(pfn, page, zone))
> >  				continue;
> >  
> 
> You need both the pfn_valid() check and the memmap_valid_within() as
> memmap_valid_within() unconditionally returns 1 for most architectures. If
> you applied this patch as-is, memory holes in a zone will cause big problems -
> random results at best and invalid memory references at worst.

Ah, zone holes.  More reading up needed.  Thanks, Mel.

	Hannes

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] Double check memmap is actually valid with a memmap has unexpected holes
@ 2009-05-06 15:50       ` Johannes Weiner
  0 siblings, 0 replies; 26+ messages in thread
From: Johannes Weiner @ 2009-05-06 15:50 UTC (permalink / raw)
  To: Mel Gorman
  Cc: akpm, linux-mm, linux-kernel, hartleys, mcrapet, linux, fred99,
	linux-arm-kernel, Badari Pulavarty, Yasunori Goto

On Wed, May 06, 2009 at 03:31:00PM +0100, Mel Gorman wrote:
> On Tue, May 05, 2009 at 01:06:53PM +0200, Johannes Weiner wrote:
> > Hi Mel,
> > 
> > On Tue, May 05, 2009 at 09:29:44AM +0100, Mel Gorman wrote:
> > > pfn_valid() is meant to be able to tell if a given PFN has valid memmap
> > > associated with it or not. In FLATMEM, it is expected that holes always
> > > have valid memmap as long as there is valid PFNs either side of the hole.
> > > In SPARSEMEM, it is assumed that a valid section has a memmap for the
> > > entire section.
> > > 
> > > However, ARM and maybe other embedded architectures in the future free
> > > memmap backing holes to save memory on the assumption the memmap is never
> > > used. The page_zone() linkages are then broken even though pfn_valid()
> > > returns true. A walker of the full memmap in this case must do additional
> > > check to ensure the memmap they are looking at is sane by making sure the
> > > zone and PFN linkages are still valid. This is expensive, but walkers of
> > > the full memmap are extremely rare.
> > > 
> > > This was caught before for FLATMEM and hacked around but it hits again
> > > for SPARSEMEM because the page_zone() linkages can look ok where the PFN
> > > linkages are totally screwed. This looks like a hatchet job but the reality
> > > is that any clean solution would end up consuming all the memory saved
> > > by punching these unexpected holes in the memmap. For example, we tried
> > > marking the memmap within the section invalid but the section size exceeds
> > > the size of the hole in most cases so pfn_valid() starts returning false
> > > where valid memmap exists. Shrinking the size of the section would increase
> > > memory consumption offsetting the gains.
> > > 
> > > This patch identifies when an architecture is punching unexpected holes
> > > in the memmap that the memory model cannot automatically detect. When set,
> > > walkers of the full memmap must call memmap_valid_within() for each PFN and
> > > passing in what it expects the page and zone to be for that PFN. If it finds
> > > the linkages to be broken, it assumes the memmap is invalid for that PFN.
> > > 
> > > Signed-off-by: Mel Gorman <mel@csn.ul.ie>
> > 
> > I think we also need to fix up show_mem(). 
> 
> As it turns out, ARM has its own show_mem(). I don't see how, but ARM
> must not be using lib/show_mem.c even though it compiles it.

It's some linker magic for lib/.  It compiles both but treats the
library version as weak symbol (or something).

But with the zone-walking show_mem, I think it should be able to use
the generic version.

> > Attached is a
> > compile-tested patch, please have a look.  I am not sure about memory
> > hotplug issues but on a quick glance the vmstat stuff seems to be
> > optimistic as well.
> > 
> > ---
> > From: Johannes Weiner <hannes@cmpxchg.org>
> > Subject: lib: adjust show_mem() to support memmap holes
> > 
> > Some architectures free the backing of mem_map holes.  pfn_valid() is
> > not able to report this properly, so a stronger check is needed if the
> > caller is about to use the page descriptor derived from a pfn.
> > 
> > Change the node walking to zone walking and use memmap_valid_within()
> > to check for holes.  This is reliable as it additionally checks for
> > page_zone() and page_to_pfn() coherency.
> > 
> > Not-yet-signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
> > ---
> >  lib/show_mem.c |   21 +++++++++------------
> >  1 files changed, 9 insertions(+), 12 deletions(-)
> > 
> > diff --git a/lib/show_mem.c b/lib/show_mem.c
> > index 238e72a..ed3c3ec 100644
> > --- a/lib/show_mem.c
> > +++ b/lib/show_mem.c
> > @@ -11,29 +11,27 @@
> >  
> >  void show_mem(void)
> >  {
> > -	pg_data_t *pgdat;
> >  	unsigned long total = 0, reserved = 0, shared = 0,
> >  		nonshared = 0, highmem = 0;
> > +	struct zone *zone;
> >  
> >  	printk(KERN_INFO "Mem-Info:\n");
> >  	show_free_areas();
> >  
> > -	for_each_online_pgdat(pgdat) {
> > -		unsigned long i, flags;
> > +	for_each_populated_zone(zone) {
> > +		unsigned long start = zone->zone_start_pfn;
> > +		unsigned long end = start + zone->spanned_pages;
> 
> The patch appears to be doing two things
> 
> o Scanning zones instead of pgdats
> o Adding the use of memmap_valid_within()
> 
> Scanning zones instead of pgdats seems like a good idea on its own and should
> be split out for separate consideration.

Good idea.  Will do.

> > +		unsigned long pfn;
> >  
> > -		pgdat_resize_lock(pgdat, &flags);
> 
> How sure are you about removing the acquisition of this lock?  If anything,
> it appears that pagetypeinfo_showblockcount_print() should be taking this lock.

I'm completely unsure about it.

<adds memory hotplug guys to CC>

> > -		for (i = 0; i < pgdat->node_spanned_pages; i++) {
> > -			struct page *page;
> > -			unsigned long pfn = pgdat->node_start_pfn + i;
> > +		for (pfn = start; pfn < end; pfn++) {
> > +			struct page *page = pfn_to_page(pfn);
> >  
> 
> You need to check pfn_valid() before using pfn_to_page().
> 
> > -			if (unlikely(!(i % MAX_ORDER_NR_PAGES)))
> > +			if (unlikely(!(pfn % MAX_ORDER_NR_PAGES)))
> >  				touch_nmi_watchdog();
> >  
> > -			if (!pfn_valid(pfn))
> > +			if (!memmap_valid_within(pfn, page, zone))
> >  				continue;
> >  
> 
> You need both the pfn_valid() check and the memmap_valid_within() as
> memmap_valid_within() unconditionally returns 1 for most architectures. If
> you applied this patch as-is, memory holes in a zone will cause big problems -
> random results at best and invalid memory references at worst.

Ah, zone holes.  More reading up needed.  Thanks, Mel.

	Hannes

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] Double check memmap is actually valid with a memmap has unexpected holes
  2009-05-06 14:31     ` Mel Gorman
@ 2009-05-06 19:20       ` Russell King - ARM Linux
  -1 siblings, 0 replies; 26+ messages in thread
From: Russell King - ARM Linux @ 2009-05-06 19:20 UTC (permalink / raw)
  To: Mel Gorman
  Cc: Johannes Weiner, akpm, linux-mm, linux-kernel, hartleys, mcrapet,
	fred99, linux-arm-kernel

On Wed, May 06, 2009 at 03:31:00PM +0100, Mel Gorman wrote:
> On Tue, May 05, 2009 at 01:06:53PM +0200, Johannes Weiner wrote:
> > I think we also need to fix up show_mem(). 
> 
> As it turns out, ARM has its own show_mem(). I don't see how, but ARM
> must not be using lib/show_mem.c even though it compiles it.

That happens because lib/show_mem.c is a library file, and since there
isn't an unresolved reference to show_mem in from within the object
files ld is asked to link, the version in the .a library won't be
brought in.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] Double check memmap is actually valid with a memmap has unexpected holes
@ 2009-05-06 19:20       ` Russell King - ARM Linux
  0 siblings, 0 replies; 26+ messages in thread
From: Russell King - ARM Linux @ 2009-05-06 19:20 UTC (permalink / raw)
  To: Mel Gorman
  Cc: Johannes Weiner, akpm, linux-mm, linux-kernel, hartleys, mcrapet,
	fred99, linux-arm-kernel

On Wed, May 06, 2009 at 03:31:00PM +0100, Mel Gorman wrote:
> On Tue, May 05, 2009 at 01:06:53PM +0200, Johannes Weiner wrote:
> > I think we also need to fix up show_mem(). 
> 
> As it turns out, ARM has its own show_mem(). I don't see how, but ARM
> must not be using lib/show_mem.c even though it compiles it.

That happens because lib/show_mem.c is a library file, and since there
isn't an unresolved reference to show_mem in from within the object
files ld is asked to link, the version in the .a library won't be
brought in.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] Double check memmap is actually valid with a memmap has unexpected holes
  2009-05-06 15:50       ` Johannes Weiner
@ 2009-05-07  5:29         ` Yasunori Goto
  -1 siblings, 0 replies; 26+ messages in thread
From: Yasunori Goto @ 2009-05-07  5:29 UTC (permalink / raw)
  To: Johannes Weiner
  Cc: Mel Gorman, akpm, linux-mm, linux-kernel, hartleys, mcrapet,
	linux, fred99, linux-arm-kernel, Badari Pulavarty

Hi.

> > > +		unsigned long pfn;
> > >  
> > > -		pgdat_resize_lock(pgdat, &flags);
> > 
> > How sure are you about removing the acquisition of this lock?  If anything,
> > it appears that pagetypeinfo_showblockcount_print() should be taking this lock.
> 
> I'm completely unsure about it.
> 
> <adds memory hotplug guys to CC>

zone->zone_start_pfn and zone->spanned_pages may be changed by memory hotplug.
The lock must be acquired before getting their values as Mel-san said.

Thanks.

-- 
Yasunori Goto 



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] Double check memmap is actually valid with a memmap has unexpected holes
@ 2009-05-07  5:29         ` Yasunori Goto
  0 siblings, 0 replies; 26+ messages in thread
From: Yasunori Goto @ 2009-05-07  5:29 UTC (permalink / raw)
  To: Johannes Weiner
  Cc: Mel Gorman, akpm, linux-mm, linux-kernel, hartleys, mcrapet,
	linux, fred99, linux-arm-kernel, Badari Pulavarty

Hi.

> > > +		unsigned long pfn;
> > >  
> > > -		pgdat_resize_lock(pgdat, &flags);
> > 
> > How sure are you about removing the acquisition of this lock?  If anything,
> > it appears that pagetypeinfo_showblockcount_print() should be taking this lock.
> 
> I'm completely unsure about it.
> 
> <adds memory hotplug guys to CC>

zone->zone_start_pfn and zone->spanned_pages may be changed by memory hotplug.
The lock must be acquired before getting their values as Mel-san said.

Thanks.

-- 
Yasunori Goto 


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH] Double check memmap is actually valid with a memmap has unexpected holes V2
  2009-05-05  8:49     ` Mel Gorman
@ 2009-05-13 16:34       ` Mel Gorman
  -1 siblings, 0 replies; 26+ messages in thread
From: Mel Gorman @ 2009-05-13 16:34 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: akpm, linux-mm, linux-kernel, hartleys, mcrapet, fred99,
	linux-arm-kernel

On Tue, May 05, 2009 at 09:49:28AM +0100, Mel Gorman wrote:
> On Tue, May 05, 2009 at 09:36:14AM +0100, Russell King - ARM Linux wrote:
> > On Tue, May 05, 2009 at 09:29:44AM +0100, Mel Gorman wrote:
> > > diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> > > index e02b893..6d79051 100644
> > > --- a/arch/arm/Kconfig
> > > +++ b/arch/arm/Kconfig
> > > @@ -925,10 +925,9 @@ config OABI_COMPAT
> > >  	  UNPREDICTABLE (in fact it can be predicted that it won't work
> > >  	  at all). If in doubt say Y.
> > >  
> > > -config ARCH_FLATMEM_HAS_HOLES
> > > +config ARCH_HAS_HOLES_MEMORYMODEL
> > 
> > Can we arrange for EP93xx to select this so we don't have it enabled for
> > everyone.
> > 
> > The other user of this was RPC when it was flatmem only, but since it has
> > been converted to sparsemem it's no longer an issue there.
> > 
> 
> This problem is hitting SPARSEMEM, at least according to reports I have
> been cc'd on so it's not a SPARSEMEM vs FLATMEM thing. From the leader --
> "This was caught before for FLATMEM and hacked around but it hits again for
> SPARSEMEM because the page_zone linkages can look ok where the PFN linkages
> are totally screwed."
> 
> If you feel that this problem is only encountered on the EP93xx, then the
> option could be made more conservative with the following (untested) patch
> and then wait to see who complains.
> 

This problem is still there. Russell, would you be ok with picking up
this version of the fix? There were suggestions for modifying the
generic code further but they are not critical to the problem on ARM and
could be done as a follow-up patch.

==== CUT HERE ====
Double check memmap is actually valid with a memmap has unexpected holes V2

Changelog since V1
  o Restrict to EP93xx

pfn_valid() is meant to be able to tell if a given PFN has valid memmap
associated with it or not. In FLATMEM, it is expected that holes always
have valid memmap as long as there is valid PFNs either side of the hole.
In SPARSEMEM, it is assumed that a valid section has a memmap for the
entire section.

However, ARM and maybe other embedded architectures in the future free
memmap backing holes to save memory on the assumption the memmap is never
used. The page_zone linkages are then broken even though pfn_valid()
returns true. A walker of the full memmap must then do this additional
check to ensure the memmap they are looking at is sane by making sure the
zone and PFN linkages are still valid. This is expensive, but walkers of
the full memmap are extremely rare.

This was caught before for FLATMEM and hacked around but it hits again for
SPARSEMEM because the page_zone linkages can look ok where the PFN linkages
are totally screwed. This looks like a hatchet job but the reality is that
any clean solution would end up consumning all the memory saved by punching
these unexpected holes in the memmap. For example, we tried marking the
memmap within the section invalid but the section size exceeds the size of
the hole in most cases so pfn_valid() starts returning false where valid
memmap exists. Shrinking the size of the section would increase memory
consumption offsetting the gains.

This patch identifies when an architecture is punching unexpected holes
in the memmap that the memory model cannot automatically detect and sets
ARCH_HAS_HOLES_MEMORYMODEL. At the moment, this is restricted to EP93xx
which is the model sub-architecture this has been reported on but may expand
later. When set, walkers of the full memmap must call memmap_valid_within()
for each PFN and passing in what it expects the page and zone to be for
that PFN. If it finds the linkages to be broken, it assumes the memmap is
invalid for that PFN.

Signed-off-by: Mel Gorman <mel@csn.ul.ie>
--- 
 arch/arm/Kconfig       |    6 +++---
 include/linux/mmzone.h |   26 ++++++++++++++++++++++++++
 mm/mmzone.c            |   15 +++++++++++++++
 mm/vmstat.c            |   19 ++++---------------
 4 files changed, 48 insertions(+), 18 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index e02b893..a4c195c 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -273,6 +273,7 @@ config ARCH_EP93XX
 	select HAVE_CLK
 	select COMMON_CLKDEV
 	select ARCH_REQUIRE_GPIOLIB
+	select ARCH_HAS_HOLES_MEMORYMODEL
 	help
 	  This enables support for the Cirrus EP93xx series of CPUs.
 
@@ -925,10 +926,9 @@ config OABI_COMPAT
 	  UNPREDICTABLE (in fact it can be predicted that it won't work
 	  at all). If in doubt say Y.
 
-config ARCH_FLATMEM_HAS_HOLES
+config ARCH_HAS_HOLES_MEMORYMODEL
 	bool
-	default y
-	depends on FLATMEM
+	default n
 
 # Discontigmem is deprecated
 config ARCH_DISCONTIGMEM_ENABLE
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 1ff59fd..d20513a 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -1104,6 +1104,32 @@ unsigned long __init node_memmap_size_bytes(int, unsigned long, unsigned long);
 #define pfn_valid_within(pfn) (1)
 #endif
 
+#ifdef CONFIG_ARCH_HAS_HOLES_MEMORYMODEL
+/*
+ * pfn_valid() is meant to be able to tell if a given PFN has valid memmap
+ * associated with it or not. In FLATMEM, it is expected that holes always
+ * have valid memmap as long as there is valid PFNs either side of the hole.
+ * In SPARSEMEM, it is assumed that a valid section has a memmap for the
+ * entire section.
+ *
+ * However, an ARM, and maybe other embedded architectures in the future
+ * free memmap backing holes to save memory on the assumption the memmap is
+ * never used. The page_zone linkages are then broken even though pfn_valid()
+ * returns true. A walker of the full memmap must then do this additional
+ * check to ensure the memmap they are looking at is sane by making sure
+ * the zone and PFN linkages are still valid. This is expensive, but walkers
+ * of the full memmap are extremely rare.
+ */
+int memmap_valid_within(unsigned long pfn,
+					struct page *page, struct zone *zone);
+#else
+static inline int memmap_valid_within(unsigned long pfn,
+					struct page *page, struct zone *zone)
+{
+	return 1;
+}
+#endif /* CONFIG_ARCH_HAS_HOLES_MEMORYMODEL */
+
 #endif /* !__GENERATING_BOUNDS.H */
 #endif /* !__ASSEMBLY__ */
 #endif /* _LINUX_MMZONE_H */
diff --git a/mm/mmzone.c b/mm/mmzone.c
index 16ce8b9..f5b7d17 100644
--- a/mm/mmzone.c
+++ b/mm/mmzone.c
@@ -6,6 +6,7 @@
 
 
 #include <linux/stddef.h>
+#include <linux/mm.h>
 #include <linux/mmzone.h>
 #include <linux/module.h>
 
@@ -72,3 +73,17 @@ struct zoneref *next_zones_zonelist(struct zoneref *z,
 	*zone = zonelist_zone(z);
 	return z;
 }
+
+#ifdef CONFIG_ARCH_HAS_HOLES_MEMORYMODEL
+int memmap_valid_within(unsigned long pfn,
+					struct page *page, struct zone *zone)
+{
+	if (page_to_pfn(page) != pfn)
+		return 0;
+
+	if (page_zone(page) != zone)
+		return 0;
+
+	return 1;
+}
+#endif /* CONFIG_ARCH_HAS_HOLES_MEMORYMODEL */
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 17f2abb..03ee651 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -509,22 +509,11 @@ static void pagetypeinfo_showblockcount_print(struct seq_file *m,
 			continue;
 
 		page = pfn_to_page(pfn);
-#ifdef CONFIG_ARCH_FLATMEM_HAS_HOLES
-		/*
-		 * Ordinarily, memory holes in flatmem still have a valid
-		 * memmap for the PFN range. However, an architecture for
-		 * embedded systems (e.g. ARM) can free up the memmap backing
-		 * holes to save memory on the assumption the memmap is
-		 * never used. The page_zone linkages are then broken even
-		 * though pfn_valid() returns true. Skip the page if the
-		 * linkages are broken. Even if this test passed, the impact
-		 * is that the counters for the movable type are off but
-		 * fragmentation monitoring is likely meaningless on small
-		 * systems.
-		 */
-		if (page_zone(page) != zone)
+
+		/* Watch for unexpected holes punched in the memmap */
+		if (!memmap_valid_within(pfn, page, zone))
 			continue;
-#endif
+
 		mtype = get_pageblock_migratetype(page);
 
 		if (mtype < MIGRATE_TYPES)

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH] Double check memmap is actually valid with a memmap has unexpected holes V2
@ 2009-05-13 16:34       ` Mel Gorman
  0 siblings, 0 replies; 26+ messages in thread
From: Mel Gorman @ 2009-05-13 16:34 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: akpm, linux-mm, linux-kernel, hartleys, mcrapet, fred99,
	linux-arm-kernel

On Tue, May 05, 2009 at 09:49:28AM +0100, Mel Gorman wrote:
> On Tue, May 05, 2009 at 09:36:14AM +0100, Russell King - ARM Linux wrote:
> > On Tue, May 05, 2009 at 09:29:44AM +0100, Mel Gorman wrote:
> > > diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> > > index e02b893..6d79051 100644
> > > --- a/arch/arm/Kconfig
> > > +++ b/arch/arm/Kconfig
> > > @@ -925,10 +925,9 @@ config OABI_COMPAT
> > >  	  UNPREDICTABLE (in fact it can be predicted that it won't work
> > >  	  at all). If in doubt say Y.
> > >  
> > > -config ARCH_FLATMEM_HAS_HOLES
> > > +config ARCH_HAS_HOLES_MEMORYMODEL
> > 
> > Can we arrange for EP93xx to select this so we don't have it enabled for
> > everyone.
> > 
> > The other user of this was RPC when it was flatmem only, but since it has
> > been converted to sparsemem it's no longer an issue there.
> > 
> 
> This problem is hitting SPARSEMEM, at least according to reports I have
> been cc'd on so it's not a SPARSEMEM vs FLATMEM thing. From the leader --
> "This was caught before for FLATMEM and hacked around but it hits again for
> SPARSEMEM because the page_zone linkages can look ok where the PFN linkages
> are totally screwed."
> 
> If you feel that this problem is only encountered on the EP93xx, then the
> option could be made more conservative with the following (untested) patch
> and then wait to see who complains.
> 

This problem is still there. Russell, would you be ok with picking up
this version of the fix? There were suggestions for modifying the
generic code further but they are not critical to the problem on ARM and
could be done as a follow-up patch.

==== CUT HERE ====
Double check memmap is actually valid with a memmap has unexpected holes V2

Changelog since V1
  o Restrict to EP93xx

pfn_valid() is meant to be able to tell if a given PFN has valid memmap
associated with it or not. In FLATMEM, it is expected that holes always
have valid memmap as long as there is valid PFNs either side of the hole.
In SPARSEMEM, it is assumed that a valid section has a memmap for the
entire section.

However, ARM and maybe other embedded architectures in the future free
memmap backing holes to save memory on the assumption the memmap is never
used. The page_zone linkages are then broken even though pfn_valid()
returns true. A walker of the full memmap must then do this additional
check to ensure the memmap they are looking at is sane by making sure the
zone and PFN linkages are still valid. This is expensive, but walkers of
the full memmap are extremely rare.

This was caught before for FLATMEM and hacked around but it hits again for
SPARSEMEM because the page_zone linkages can look ok where the PFN linkages
are totally screwed. This looks like a hatchet job but the reality is that
any clean solution would end up consumning all the memory saved by punching
these unexpected holes in the memmap. For example, we tried marking the
memmap within the section invalid but the section size exceeds the size of
the hole in most cases so pfn_valid() starts returning false where valid
memmap exists. Shrinking the size of the section would increase memory
consumption offsetting the gains.

This patch identifies when an architecture is punching unexpected holes
in the memmap that the memory model cannot automatically detect and sets
ARCH_HAS_HOLES_MEMORYMODEL. At the moment, this is restricted to EP93xx
which is the model sub-architecture this has been reported on but may expand
later. When set, walkers of the full memmap must call memmap_valid_within()
for each PFN and passing in what it expects the page and zone to be for
that PFN. If it finds the linkages to be broken, it assumes the memmap is
invalid for that PFN.

Signed-off-by: Mel Gorman <mel@csn.ul.ie>
--- 
 arch/arm/Kconfig       |    6 +++---
 include/linux/mmzone.h |   26 ++++++++++++++++++++++++++
 mm/mmzone.c            |   15 +++++++++++++++
 mm/vmstat.c            |   19 ++++---------------
 4 files changed, 48 insertions(+), 18 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index e02b893..a4c195c 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -273,6 +273,7 @@ config ARCH_EP93XX
 	select HAVE_CLK
 	select COMMON_CLKDEV
 	select ARCH_REQUIRE_GPIOLIB
+	select ARCH_HAS_HOLES_MEMORYMODEL
 	help
 	  This enables support for the Cirrus EP93xx series of CPUs.
 
@@ -925,10 +926,9 @@ config OABI_COMPAT
 	  UNPREDICTABLE (in fact it can be predicted that it won't work
 	  at all). If in doubt say Y.
 
-config ARCH_FLATMEM_HAS_HOLES
+config ARCH_HAS_HOLES_MEMORYMODEL
 	bool
-	default y
-	depends on FLATMEM
+	default n
 
 # Discontigmem is deprecated
 config ARCH_DISCONTIGMEM_ENABLE
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 1ff59fd..d20513a 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -1104,6 +1104,32 @@ unsigned long __init node_memmap_size_bytes(int, unsigned long, unsigned long);
 #define pfn_valid_within(pfn) (1)
 #endif
 
+#ifdef CONFIG_ARCH_HAS_HOLES_MEMORYMODEL
+/*
+ * pfn_valid() is meant to be able to tell if a given PFN has valid memmap
+ * associated with it or not. In FLATMEM, it is expected that holes always
+ * have valid memmap as long as there is valid PFNs either side of the hole.
+ * In SPARSEMEM, it is assumed that a valid section has a memmap for the
+ * entire section.
+ *
+ * However, an ARM, and maybe other embedded architectures in the future
+ * free memmap backing holes to save memory on the assumption the memmap is
+ * never used. The page_zone linkages are then broken even though pfn_valid()
+ * returns true. A walker of the full memmap must then do this additional
+ * check to ensure the memmap they are looking at is sane by making sure
+ * the zone and PFN linkages are still valid. This is expensive, but walkers
+ * of the full memmap are extremely rare.
+ */
+int memmap_valid_within(unsigned long pfn,
+					struct page *page, struct zone *zone);
+#else
+static inline int memmap_valid_within(unsigned long pfn,
+					struct page *page, struct zone *zone)
+{
+	return 1;
+}
+#endif /* CONFIG_ARCH_HAS_HOLES_MEMORYMODEL */
+
 #endif /* !__GENERATING_BOUNDS.H */
 #endif /* !__ASSEMBLY__ */
 #endif /* _LINUX_MMZONE_H */
diff --git a/mm/mmzone.c b/mm/mmzone.c
index 16ce8b9..f5b7d17 100644
--- a/mm/mmzone.c
+++ b/mm/mmzone.c
@@ -6,6 +6,7 @@
 
 
 #include <linux/stddef.h>
+#include <linux/mm.h>
 #include <linux/mmzone.h>
 #include <linux/module.h>
 
@@ -72,3 +73,17 @@ struct zoneref *next_zones_zonelist(struct zoneref *z,
 	*zone = zonelist_zone(z);
 	return z;
 }
+
+#ifdef CONFIG_ARCH_HAS_HOLES_MEMORYMODEL
+int memmap_valid_within(unsigned long pfn,
+					struct page *page, struct zone *zone)
+{
+	if (page_to_pfn(page) != pfn)
+		return 0;
+
+	if (page_zone(page) != zone)
+		return 0;
+
+	return 1;
+}
+#endif /* CONFIG_ARCH_HAS_HOLES_MEMORYMODEL */
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 17f2abb..03ee651 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -509,22 +509,11 @@ static void pagetypeinfo_showblockcount_print(struct seq_file *m,
 			continue;
 
 		page = pfn_to_page(pfn);
-#ifdef CONFIG_ARCH_FLATMEM_HAS_HOLES
-		/*
-		 * Ordinarily, memory holes in flatmem still have a valid
-		 * memmap for the PFN range. However, an architecture for
-		 * embedded systems (e.g. ARM) can free up the memmap backing
-		 * holes to save memory on the assumption the memmap is
-		 * never used. The page_zone linkages are then broken even
-		 * though pfn_valid() returns true. Skip the page if the
-		 * linkages are broken. Even if this test passed, the impact
-		 * is that the counters for the movable type are off but
-		 * fragmentation monitoring is likely meaningless on small
-		 * systems.
-		 */
-		if (page_zone(page) != zone)
+
+		/* Watch for unexpected holes punched in the memmap */
+		if (!memmap_valid_within(pfn, page, zone))
 			continue;
-#endif
+
 		mtype = get_pageblock_migratetype(page);
 
 		if (mtype < MIGRATE_TYPES)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH] Double check memmap is actually valid with a memmap has unexpected holes V2
  2009-05-13 16:34       ` Mel Gorman
@ 2009-05-13 19:48         ` Andrew Morton
  -1 siblings, 0 replies; 26+ messages in thread
From: Andrew Morton @ 2009-05-13 19:48 UTC (permalink / raw)
  To: Mel Gorman
  Cc: linux, linux-mm, linux-kernel, hartleys, mcrapet, fred99,
	linux-arm-kernel

On Wed, 13 May 2009 17:34:48 +0100
Mel Gorman <mel@csn.ul.ie> wrote:

> pfn_valid() is meant to be able to tell if a given PFN has valid memmap
> associated with it or not. In FLATMEM, it is expected that holes always
> have valid memmap as long as there is valid PFNs either side of the hole.
> In SPARSEMEM, it is assumed that a valid section has a memmap for the
> entire section.
> 
> However, ARM and maybe other embedded architectures in the future free
> memmap backing holes to save memory on the assumption the memmap is never
> used. The page_zone linkages are then broken even though pfn_valid()
> returns true. A walker of the full memmap must then do this additional
> check to ensure the memmap they are looking at is sane by making sure the
> zone and PFN linkages are still valid. This is expensive, but walkers of
> the full memmap are extremely rare.
> 
> This was caught before for FLATMEM and hacked around but it hits again for
> SPARSEMEM because the page_zone linkages can look ok where the PFN linkages
> are totally screwed. This looks like a hatchet job but the reality is that
> any clean solution would end up consumning all the memory saved by punching
> these unexpected holes in the memmap. For example, we tried marking the
> memmap within the section invalid but the section size exceeds the size of
> the hole in most cases so pfn_valid() starts returning false where valid
> memmap exists. Shrinking the size of the section would increase memory
> consumption offsetting the gains.
> 
> This patch identifies when an architecture is punching unexpected holes
> in the memmap that the memory model cannot automatically detect and sets
> ARCH_HAS_HOLES_MEMORYMODEL. At the moment, this is restricted to EP93xx
> which is the model sub-architecture this has been reported on but may expand
> later. When set, walkers of the full memmap must call memmap_valid_within()
> for each PFN and passing in what it expects the page and zone to be for
> that PFN. If it finds the linkages to be broken, it assumes the memmap is
> invalid for that PFN.

It's unclear to me whether this patch is needed in 2.6.30 or even
2.6.29 or whatever.

It applies OK to 2.6.28, 2.6.29, current mainline and mmotm, so I'll
just sit tight until I'm told what to do.


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] Double check memmap is actually valid with a memmap has unexpected holes V2
@ 2009-05-13 19:48         ` Andrew Morton
  0 siblings, 0 replies; 26+ messages in thread
From: Andrew Morton @ 2009-05-13 19:48 UTC (permalink / raw)
  To: Mel Gorman
  Cc: linux, linux-mm, linux-kernel, hartleys, mcrapet, fred99,
	linux-arm-kernel

On Wed, 13 May 2009 17:34:48 +0100
Mel Gorman <mel@csn.ul.ie> wrote:

> pfn_valid() is meant to be able to tell if a given PFN has valid memmap
> associated with it or not. In FLATMEM, it is expected that holes always
> have valid memmap as long as there is valid PFNs either side of the hole.
> In SPARSEMEM, it is assumed that a valid section has a memmap for the
> entire section.
> 
> However, ARM and maybe other embedded architectures in the future free
> memmap backing holes to save memory on the assumption the memmap is never
> used. The page_zone linkages are then broken even though pfn_valid()
> returns true. A walker of the full memmap must then do this additional
> check to ensure the memmap they are looking at is sane by making sure the
> zone and PFN linkages are still valid. This is expensive, but walkers of
> the full memmap are extremely rare.
> 
> This was caught before for FLATMEM and hacked around but it hits again for
> SPARSEMEM because the page_zone linkages can look ok where the PFN linkages
> are totally screwed. This looks like a hatchet job but the reality is that
> any clean solution would end up consumning all the memory saved by punching
> these unexpected holes in the memmap. For example, we tried marking the
> memmap within the section invalid but the section size exceeds the size of
> the hole in most cases so pfn_valid() starts returning false where valid
> memmap exists. Shrinking the size of the section would increase memory
> consumption offsetting the gains.
> 
> This patch identifies when an architecture is punching unexpected holes
> in the memmap that the memory model cannot automatically detect and sets
> ARCH_HAS_HOLES_MEMORYMODEL. At the moment, this is restricted to EP93xx
> which is the model sub-architecture this has been reported on but may expand
> later. When set, walkers of the full memmap must call memmap_valid_within()
> for each PFN and passing in what it expects the page and zone to be for
> that PFN. If it finds the linkages to be broken, it assumes the memmap is
> invalid for that PFN.

It's unclear to me whether this patch is needed in 2.6.30 or even
2.6.29 or whatever.

It applies OK to 2.6.28, 2.6.29, current mainline and mmotm, so I'll
just sit tight until I'm told what to do.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] Double check memmap is actually valid with a memmap has unexpected holes V2
  2009-05-13 19:48         ` Andrew Morton
@ 2009-05-14  8:39           ` Mel Gorman
  -1 siblings, 0 replies; 26+ messages in thread
From: Mel Gorman @ 2009-05-14  8:39 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux, linux-mm, linux-kernel, hartleys, mcrapet, fred99,
	linux-arm-kernel

On Wed, May 13, 2009 at 12:48:05PM -0700, Andrew Morton wrote:
> On Wed, 13 May 2009 17:34:48 +0100
> Mel Gorman <mel@csn.ul.ie> wrote:
> 
> > pfn_valid() is meant to be able to tell if a given PFN has valid memmap
> > associated with it or not. In FLATMEM, it is expected that holes always
> > have valid memmap as long as there is valid PFNs either side of the hole.
> > In SPARSEMEM, it is assumed that a valid section has a memmap for the
> > entire section.
> > 
> > However, ARM and maybe other embedded architectures in the future free
> > memmap backing holes to save memory on the assumption the memmap is never
> > used. The page_zone linkages are then broken even though pfn_valid()
> > returns true. A walker of the full memmap must then do this additional
> > check to ensure the memmap they are looking at is sane by making sure the
> > zone and PFN linkages are still valid. This is expensive, but walkers of
> > the full memmap are extremely rare.
> > 
> > This was caught before for FLATMEM and hacked around but it hits again for
> > SPARSEMEM because the page_zone linkages can look ok where the PFN linkages
> > are totally screwed. This looks like a hatchet job but the reality is that
> > any clean solution would end up consumning all the memory saved by punching
> > these unexpected holes in the memmap. For example, we tried marking the
> > memmap within the section invalid but the section size exceeds the size of
> > the hole in most cases so pfn_valid() starts returning false where valid
> > memmap exists. Shrinking the size of the section would increase memory
> > consumption offsetting the gains.
> > 
> > This patch identifies when an architecture is punching unexpected holes
> > in the memmap that the memory model cannot automatically detect and sets
> > ARCH_HAS_HOLES_MEMORYMODEL. At the moment, this is restricted to EP93xx
> > which is the model sub-architecture this has been reported on but may expand
> > later. When set, walkers of the full memmap must call memmap_valid_within()
> > for each PFN and passing in what it expects the page and zone to be for
> > that PFN. If it finds the linkages to be broken, it assumes the memmap is
> > invalid for that PFN.
> 
> It's unclear to me whether this patch is needed in 2.6.30 or even
> 2.6.29 or whatever.
> 

It affected at least 2.6.28.4 so minimally, I'd like to see it in for 2.6.30. I
think it's a -stable candidate but I'd like to hear from the ARM maintainer
on whether he wants to push it or not to that tree.

> It applies OK to 2.6.28, 2.6.29, current mainline and mmotm, so I'll
> just sit tight until I'm told what to do.
> 

Please merge for 2.6.30 at least. Russell, are you ok with that? Are you ok
with this being pushed to -stable?

Thanks

-- 
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] Double check memmap is actually valid with a memmap has unexpected holes V2
@ 2009-05-14  8:39           ` Mel Gorman
  0 siblings, 0 replies; 26+ messages in thread
From: Mel Gorman @ 2009-05-14  8:39 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux, linux-mm, linux-kernel, hartleys, mcrapet, fred99,
	linux-arm-kernel

On Wed, May 13, 2009 at 12:48:05PM -0700, Andrew Morton wrote:
> On Wed, 13 May 2009 17:34:48 +0100
> Mel Gorman <mel@csn.ul.ie> wrote:
> 
> > pfn_valid() is meant to be able to tell if a given PFN has valid memmap
> > associated with it or not. In FLATMEM, it is expected that holes always
> > have valid memmap as long as there is valid PFNs either side of the hole.
> > In SPARSEMEM, it is assumed that a valid section has a memmap for the
> > entire section.
> > 
> > However, ARM and maybe other embedded architectures in the future free
> > memmap backing holes to save memory on the assumption the memmap is never
> > used. The page_zone linkages are then broken even though pfn_valid()
> > returns true. A walker of the full memmap must then do this additional
> > check to ensure the memmap they are looking at is sane by making sure the
> > zone and PFN linkages are still valid. This is expensive, but walkers of
> > the full memmap are extremely rare.
> > 
> > This was caught before for FLATMEM and hacked around but it hits again for
> > SPARSEMEM because the page_zone linkages can look ok where the PFN linkages
> > are totally screwed. This looks like a hatchet job but the reality is that
> > any clean solution would end up consumning all the memory saved by punching
> > these unexpected holes in the memmap. For example, we tried marking the
> > memmap within the section invalid but the section size exceeds the size of
> > the hole in most cases so pfn_valid() starts returning false where valid
> > memmap exists. Shrinking the size of the section would increase memory
> > consumption offsetting the gains.
> > 
> > This patch identifies when an architecture is punching unexpected holes
> > in the memmap that the memory model cannot automatically detect and sets
> > ARCH_HAS_HOLES_MEMORYMODEL. At the moment, this is restricted to EP93xx
> > which is the model sub-architecture this has been reported on but may expand
> > later. When set, walkers of the full memmap must call memmap_valid_within()
> > for each PFN and passing in what it expects the page and zone to be for
> > that PFN. If it finds the linkages to be broken, it assumes the memmap is
> > invalid for that PFN.
> 
> It's unclear to me whether this patch is needed in 2.6.30 or even
> 2.6.29 or whatever.
> 

It affected at least 2.6.28.4 so minimally, I'd like to see it in for 2.6.30. I
think it's a -stable candidate but I'd like to hear from the ARM maintainer
on whether he wants to push it or not to that tree.

> It applies OK to 2.6.28, 2.6.29, current mainline and mmotm, so I'll
> just sit tight until I'm told what to do.
> 

Please merge for 2.6.30 at least. Russell, are you ok with that? Are you ok
with this being pushed to -stable?

Thanks

-- 
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] Double check memmap is actually valid with a memmap has unexpected holes
  2009-05-06 15:50       ` Johannes Weiner
@ 2009-05-14 17:02         ` Paul Mundt
  -1 siblings, 0 replies; 26+ messages in thread
From: Paul Mundt @ 2009-05-14 17:02 UTC (permalink / raw)
  To: Johannes Weiner
  Cc: Mel Gorman, akpm, linux-mm, linux-kernel, hartleys, mcrapet,
	linux, fred99, linux-arm-kernel, Badari Pulavarty, Yasunori Goto

On Wed, May 06, 2009 at 05:50:43PM +0200, Johannes Weiner wrote:
> On Wed, May 06, 2009 at 03:31:00PM +0100, Mel Gorman wrote:
> > As it turns out, ARM has its own show_mem(). I don't see how, but ARM
> > must not be using lib/show_mem.c even though it compiles it.
> 
> It's some linker magic for lib/.  It compiles both but treats the
> library version as weak symbol (or something).
> 
This is true for lib-y handling in general, which lib/show_mem.o falls
under. Much of lib/ is obj-y though due to the fact that EXPORT_SYMBOL's
from lib-y are ineffective (people seem to get bitten by this at least
once a week), as a result, many things that start out as lib-y are
gradually moved over to obj-y, meaning that __weak annotations in obj-y
objects start to take precedent over lib-y magic anyways.. :-)

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] Double check memmap is actually valid with a memmap has unexpected holes
@ 2009-05-14 17:02         ` Paul Mundt
  0 siblings, 0 replies; 26+ messages in thread
From: Paul Mundt @ 2009-05-14 17:02 UTC (permalink / raw)
  To: Johannes Weiner
  Cc: Mel Gorman, akpm, linux-mm, linux-kernel, hartleys, mcrapet,
	linux, fred99, linux-arm-kernel, Badari Pulavarty, Yasunori Goto

On Wed, May 06, 2009 at 05:50:43PM +0200, Johannes Weiner wrote:
> On Wed, May 06, 2009 at 03:31:00PM +0100, Mel Gorman wrote:
> > As it turns out, ARM has its own show_mem(). I don't see how, but ARM
> > must not be using lib/show_mem.c even though it compiles it.
> 
> It's some linker magic for lib/.  It compiles both but treats the
> library version as weak symbol (or something).
> 
This is true for lib-y handling in general, which lib/show_mem.o falls
under. Much of lib/ is obj-y though due to the fact that EXPORT_SYMBOL's
from lib-y are ineffective (people seem to get bitten by this at least
once a week), as a result, many things that start out as lib-y are
gradually moved over to obj-y, meaning that __weak annotations in obj-y
objects start to take precedent over lib-y magic anyways.. :-)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] Double check memmap is actually valid with a memmap has unexpected holes V2
  2009-05-14  8:39           ` Mel Gorman
@ 2009-05-17 16:27             ` Russell King - ARM Linux
  -1 siblings, 0 replies; 26+ messages in thread
From: Russell King - ARM Linux @ 2009-05-17 16:27 UTC (permalink / raw)
  To: Mel Gorman
  Cc: Andrew Morton, linux-mm, linux-kernel, hartleys, mcrapet, fred99,
	linux-arm-kernel

On Thu, May 14, 2009 at 09:39:47AM +0100, Mel Gorman wrote:
> It affected at least 2.6.28.4 so minimally, I'd like to see it in for 2.6.30.
> I think it's a -stable candidate but I'd like to hear from the ARM maintainer
> on whether he wants to push it or not to that tree.

I'm inclined to agree.

> > It applies OK to 2.6.28, 2.6.29, current mainline and mmotm, so I'll
> > just sit tight until I'm told what to do.
> > 
> 
> Please merge for 2.6.30 at least. Russell, are you ok with that? Are you ok
> with this being pushed to -stable?

I'll merge it into my master branch, which'll be going to Linus in the next
few days.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] Double check memmap is actually valid with a memmap has unexpected holes V2
@ 2009-05-17 16:27             ` Russell King - ARM Linux
  0 siblings, 0 replies; 26+ messages in thread
From: Russell King - ARM Linux @ 2009-05-17 16:27 UTC (permalink / raw)
  To: Mel Gorman
  Cc: Andrew Morton, linux-mm, linux-kernel, hartleys, mcrapet, fred99,
	linux-arm-kernel

On Thu, May 14, 2009 at 09:39:47AM +0100, Mel Gorman wrote:
> It affected at least 2.6.28.4 so minimally, I'd like to see it in for 2.6.30.
> I think it's a -stable candidate but I'd like to hear from the ARM maintainer
> on whether he wants to push it or not to that tree.

I'm inclined to agree.

> > It applies OK to 2.6.28, 2.6.29, current mainline and mmotm, so I'll
> > just sit tight until I'm told what to do.
> > 
> 
> Please merge for 2.6.30 at least. Russell, are you ok with that? Are you ok
> with this being pushed to -stable?

I'll merge it into my master branch, which'll be going to Linus in the next
few days.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2009-05-17 16:28 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-05  8:29 [PATCH] Double check memmap is actually valid with a memmap has unexpected holes Mel Gorman
2009-05-05  8:29 ` Mel Gorman
2009-05-05  8:36 ` Russell King - ARM Linux
2009-05-05  8:36   ` Russell King - ARM Linux
2009-05-05  8:49   ` Mel Gorman
2009-05-05  8:49     ` Mel Gorman
2009-05-13 16:34     ` [PATCH] Double check memmap is actually valid with a memmap has unexpected holes V2 Mel Gorman
2009-05-13 16:34       ` Mel Gorman
2009-05-13 19:48       ` Andrew Morton
2009-05-13 19:48         ` Andrew Morton
2009-05-14  8:39         ` Mel Gorman
2009-05-14  8:39           ` Mel Gorman
2009-05-17 16:27           ` Russell King - ARM Linux
2009-05-17 16:27             ` Russell King - ARM Linux
2009-05-05 11:06 ` [PATCH] Double check memmap is actually valid with a memmap has unexpected holes Johannes Weiner
2009-05-05 11:06   ` Johannes Weiner
2009-05-06 14:31   ` Mel Gorman
2009-05-06 14:31     ` Mel Gorman
2009-05-06 15:50     ` Johannes Weiner
2009-05-06 15:50       ` Johannes Weiner
2009-05-07  5:29       ` Yasunori Goto
2009-05-07  5:29         ` Yasunori Goto
2009-05-14 17:02       ` Paul Mundt
2009-05-14 17:02         ` Paul Mundt
2009-05-06 19:20     ` Russell King - ARM Linux
2009-05-06 19:20       ` Russell King - ARM Linux

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.