Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 145179
b: refs/heads/master
c: eb33575
h: refs/heads/master
i:
  145177: 9782d5f
  145175: 2bff2c5
v: v3
  • Loading branch information
Mel Gorman authored and Russell King committed May 18, 2009
1 parent a8d251d commit 791bee0
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e1342f1da06d39b3bbd530e9306347c4438bc6e5
refs/heads/master: eb33575cf67d3f35fa2510210ef92631266e2465
6 changes: 3 additions & 3 deletions trunk/arch/arm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -976,10 +977,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
Expand Down
26 changes: 26 additions & 0 deletions trunk/include/linux/mmzone.h
Original file line number Diff line number Diff line change
Expand Up @@ -1097,6 +1097,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 */
15 changes: 15 additions & 0 deletions trunk/mm/mmzone.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@


#include <linux/stddef.h>
#include <linux/mm.h>
#include <linux/mmzone.h>
#include <linux/module.h>

Expand Down Expand Up @@ -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 */
19 changes: 4 additions & 15 deletions trunk/mm/vmstat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 791bee0

Please sign in to comment.