aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMel Gorman <mel@csn.ul.ie>2009-05-13 12:34:48 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2009-05-18 06:22:24 -0400
commiteb33575cf67d3f35fa2510210ef92631266e2465 (patch)
tree55dd9958dd10758aa5b1ad0186a3356ae620da44 /arch
parente1342f1da06d39b3bbd530e9306347c4438bc6e5 (diff)
[ARM] Double check memmap is actually valid with a memmap has unexpected holes V2
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> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Kconfig6
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index e60ec54df334..9d02cdb15b23 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -273,6 +273,7 @@ config ARCH_EP93XX
273 select HAVE_CLK 273 select HAVE_CLK
274 select COMMON_CLKDEV 274 select COMMON_CLKDEV
275 select ARCH_REQUIRE_GPIOLIB 275 select ARCH_REQUIRE_GPIOLIB
276 select ARCH_HAS_HOLES_MEMORYMODEL
276 help 277 help
277 This enables support for the Cirrus EP93xx series of CPUs. 278 This enables support for the Cirrus EP93xx series of CPUs.
278 279
@@ -976,10 +977,9 @@ config OABI_COMPAT
976 UNPREDICTABLE (in fact it can be predicted that it won't work 977 UNPREDICTABLE (in fact it can be predicted that it won't work
977 at all). If in doubt say Y. 978 at all). If in doubt say Y.
978 979
979config ARCH_FLATMEM_HAS_HOLES 980config ARCH_HAS_HOLES_MEMORYMODEL
980 bool 981 bool
981 default y 982 default n
982 depends on FLATMEM
983 983
984# Discontigmem is deprecated 984# Discontigmem is deprecated
985config ARCH_DISCONTIGMEM_ENABLE 985config ARCH_DISCONTIGMEM_ENABLE