diff options
author | Mel Gorman <mel@csn.ul.ie> | 2007-10-16 04:26:02 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 12:43:00 -0400 |
commit | 467c996c1e1910633fa8e7adc9b052aa3ed5f97c (patch) | |
tree | 09e0e70160386be1bdaa12801afddf287e12c8a1 /include | |
parent | d9c2340052278d8eb2ffb16b0484f8f794def4de (diff) |
Print out statistics in relation to fragmentation avoidance to /proc/pagetypeinfo
This patch provides fragmentation avoidance statistics via /proc/pagetypeinfo.
The information is collected only on request so there is no runtime overhead.
The statistics are in three parts:
The first part prints information on the size of blocks that pages are
being grouped on and looks like
Page block order: 10
Pages per block: 1024
The second part is a more detailed version of /proc/buddyinfo and looks like
Free pages count per migrate type at order 0 1 2 3 4 5 6 7 8 9 10
Node 0, zone DMA, type Unmovable 0 0 0 0 0 0 0 0 0 0 0
Node 0, zone DMA, type Reclaimable 1 0 0 0 0 0 0 0 0 0 0
Node 0, zone DMA, type Movable 0 0 0 0 0 0 0 0 0 0 0
Node 0, zone DMA, type Reserve 0 4 4 0 0 0 0 1 0 1 0
Node 0, zone Normal, type Unmovable 111 8 4 4 2 3 1 0 0 0 0
Node 0, zone Normal, type Reclaimable 293 89 8 0 0 0 0 0 0 0 0
Node 0, zone Normal, type Movable 1 6 13 9 7 6 3 0 0 0 0
Node 0, zone Normal, type Reserve 0 0 0 0 0 0 0 0 0 0 4
The third part looks like
Number of blocks type Unmovable Reclaimable Movable Reserve
Node 0, zone DMA 0 1 2 1
Node 0, zone Normal 3 17 94 4
To walk the zones within a node with interrupts disabled, walk_zones_in_node()
is introduced and shared between /proc/buddyinfo, /proc/zoneinfo and
/proc/pagetypeinfo to reduce code duplication. It seems specific to what
vmstat.c requires but could be broken out as a general utility function in
mmzone.c if there were other other potential users.
Signed-off-by: Mel Gorman <mel@csn.ul.ie>
Acked-by: Andy Whitcroft <apw@shadowen.org>
Acked-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/gfp.h | 12 | ||||
-rw-r--r-- | include/linux/mmzone.h | 10 |
2 files changed, 22 insertions, 0 deletions
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index f8ffcd401c5f..7e93a9ae7064 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h | |||
@@ -104,6 +104,18 @@ struct vm_area_struct; | |||
104 | /* 4GB DMA on some platforms */ | 104 | /* 4GB DMA on some platforms */ |
105 | #define GFP_DMA32 __GFP_DMA32 | 105 | #define GFP_DMA32 __GFP_DMA32 |
106 | 106 | ||
107 | /* Convert GFP flags to their corresponding migrate type */ | ||
108 | static inline int allocflags_to_migratetype(gfp_t gfp_flags) | ||
109 | { | ||
110 | WARN_ON((gfp_flags & GFP_MOVABLE_MASK) == GFP_MOVABLE_MASK); | ||
111 | |||
112 | if (unlikely(page_group_by_mobility_disabled)) | ||
113 | return MIGRATE_UNMOVABLE; | ||
114 | |||
115 | /* Group based on mobility */ | ||
116 | return (((gfp_flags & __GFP_MOVABLE) != 0) << 1) | | ||
117 | ((gfp_flags & __GFP_RECLAIMABLE) != 0); | ||
118 | } | ||
107 | 119 | ||
108 | static inline enum zone_type gfp_zone(gfp_t flags) | 120 | static inline enum zone_type gfp_zone(gfp_t flags) |
109 | { | 121 | { |
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 87a4045580f2..20ea42c45e4a 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -43,6 +43,16 @@ | |||
43 | for (order = 0; order < MAX_ORDER; order++) \ | 43 | for (order = 0; order < MAX_ORDER; order++) \ |
44 | for (type = 0; type < MIGRATE_TYPES; type++) | 44 | for (type = 0; type < MIGRATE_TYPES; type++) |
45 | 45 | ||
46 | extern int page_group_by_mobility_disabled; | ||
47 | |||
48 | static inline int get_pageblock_migratetype(struct page *page) | ||
49 | { | ||
50 | if (unlikely(page_group_by_mobility_disabled)) | ||
51 | return MIGRATE_UNMOVABLE; | ||
52 | |||
53 | return get_pageblock_flags_group(page, PB_migrate, PB_migrate_end); | ||
54 | } | ||
55 | |||
46 | struct free_area { | 56 | struct free_area { |
47 | struct list_head free_list[MIGRATE_TYPES]; | 57 | struct list_head free_list[MIGRATE_TYPES]; |
48 | unsigned long nr_free; | 58 | unsigned long nr_free; |