aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorVlastimil Babka <vbabka@suse.cz>2016-03-15 17:56:08 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-03-15 19:55:16 -0400
commit60f30350fd69a3e4d5f0f45937d3274c22565134 (patch)
treeb42539b875ffb9e71309f125cf0034c6992dc9b1 /mm
parenta0795cd416d1142117695f932a9690611ae0edbb (diff)
mm, page_owner: print migratetype of page and pageblock, symbolic flags
The information in /sys/kernel/debug/page_owner includes the migratetype of the pageblock the page belongs to. This is also checked against the page's migratetype (as declared by gfp_flags during its allocation), and the page is reported as Fallback if its migratetype differs from the pageblock's one. t This is somewhat misleading because in fact fallback allocation is not the only reason why these two can differ. It also doesn't direcly provide the page's migratetype, although it's possible to derive that from the gfp_flags. It's arguably better to print both page and pageblock's migratetype and leave the interpretation to the consumer than to suggest fallback allocation as the only possible reason. While at it, we can print the migratetypes as string the same way as /proc/pagetypeinfo does, as some of the numeric values depend on kernel configuration. For that, this patch moves the migratetype_names array from #ifdef CONFIG_PROC_FS part of mm/vmstat.c to mm/page_alloc.c and exports it. With the new format strings for flags, we can now also provide symbolic page and gfp flags in the /sys/kernel/debug/page_owner file. This replaces the positional printing of page flags as single letters, which might have looked nicer, but was limited to a subset of flags, and required the user to remember the letters. Example page_owner entry after the patch: Page allocated via order 0, mask 0x24213ca(GFP_HIGHUSER_MOVABLE|__GFP_COLD|__GFP_NOWARN|__GFP_NORETRY) PFN 520 type Movable Block 1 type Movable Flags 0xfffff8001006c(referenced|uptodate|lru|active|mappedtodisk) [<ffffffff811682c4>] __alloc_pages_nodemask+0x134/0x230 [<ffffffff811b4058>] alloc_pages_current+0x88/0x120 [<ffffffff8115e386>] __page_cache_alloc+0xe6/0x120 [<ffffffff8116ba6c>] __do_page_cache_readahead+0xdc/0x240 [<ffffffff8116bd05>] ondemand_readahead+0x135/0x260 [<ffffffff8116bfb1>] page_cache_sync_readahead+0x31/0x50 [<ffffffff81160523>] generic_file_read_iter+0x453/0x760 [<ffffffff811e0d57>] __vfs_read+0xa7/0xd0 Signed-off-by: Vlastimil Babka <vbabka@suse.cz> Acked-by: Michal Hocko <mhocko@suse.com> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> Cc: Minchan Kim <minchan@kernel.org> Cc: Sasha Levin <sasha.levin@oracle.com> Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> Cc: Mel Gorman <mgorman@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/page_alloc.c13
-rw-r--r--mm/page_owner.c24
-rw-r--r--mm/vmstat.c13
3 files changed, 20 insertions, 30 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 4e8029a7a4bf..030fafccaa6b 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -223,6 +223,19 @@ static char * const zone_names[MAX_NR_ZONES] = {
223#endif 223#endif
224}; 224};
225 225
226char * const migratetype_names[MIGRATE_TYPES] = {
227 "Unmovable",
228 "Movable",
229 "Reclaimable",
230 "HighAtomic",
231#ifdef CONFIG_CMA
232 "CMA",
233#endif
234#ifdef CONFIG_MEMORY_ISOLATION
235 "Isolate",
236#endif
237};
238
226compound_page_dtor * const compound_page_dtors[] = { 239compound_page_dtor * const compound_page_dtors[] = {
227 NULL, 240 NULL,
228 free_compound_page, 241 free_compound_page,
diff --git a/mm/page_owner.c b/mm/page_owner.c
index 983c3a10fa07..7a37a30d941b 100644
--- a/mm/page_owner.c
+++ b/mm/page_owner.c
@@ -100,8 +100,9 @@ print_page_owner(char __user *buf, size_t count, unsigned long pfn,
100 return -ENOMEM; 100 return -ENOMEM;
101 101
102 ret = snprintf(kbuf, count, 102 ret = snprintf(kbuf, count,
103 "Page allocated via order %u, mask 0x%x\n", 103 "Page allocated via order %u, mask %#x(%pGg)\n",
104 page_ext->order, page_ext->gfp_mask); 104 page_ext->order, page_ext->gfp_mask,
105 &page_ext->gfp_mask);
105 106
106 if (ret >= count) 107 if (ret >= count)
107 goto err; 108 goto err;
@@ -110,23 +111,12 @@ print_page_owner(char __user *buf, size_t count, unsigned long pfn,
110 pageblock_mt = get_pfnblock_migratetype(page, pfn); 111 pageblock_mt = get_pfnblock_migratetype(page, pfn);
111 page_mt = gfpflags_to_migratetype(page_ext->gfp_mask); 112 page_mt = gfpflags_to_migratetype(page_ext->gfp_mask);
112 ret += snprintf(kbuf + ret, count - ret, 113 ret += snprintf(kbuf + ret, count - ret,
113 "PFN %lu Block %lu type %d %s Flags %s%s%s%s%s%s%s%s%s%s%s%s\n", 114 "PFN %lu type %s Block %lu type %s Flags %#lx(%pGp)\n",
114 pfn, 115 pfn,
116 migratetype_names[page_mt],
115 pfn >> pageblock_order, 117 pfn >> pageblock_order,
116 pageblock_mt, 118 migratetype_names[pageblock_mt],
117 pageblock_mt != page_mt ? "Fallback" : " ", 119 page->flags, &page->flags);
118 PageLocked(page) ? "K" : " ",
119 PageError(page) ? "E" : " ",
120 PageReferenced(page) ? "R" : " ",
121 PageUptodate(page) ? "U" : " ",
122 PageDirty(page) ? "D" : " ",
123 PageLRU(page) ? "L" : " ",
124 PageActive(page) ? "A" : " ",
125 PageSlab(page) ? "S" : " ",
126 PageWriteback(page) ? "W" : " ",
127 PageCompound(page) ? "C" : " ",
128 PageSwapCache(page) ? "B" : " ",
129 PageMappedToDisk(page) ? "M" : " ");
130 120
131 if (ret >= count) 121 if (ret >= count)
132 goto err; 122 goto err;
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 084c6725b373..72c17981cb70 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -924,19 +924,6 @@ static void walk_zones_in_node(struct seq_file *m, pg_data_t *pgdat,
924#endif 924#endif
925 925
926#ifdef CONFIG_PROC_FS 926#ifdef CONFIG_PROC_FS
927static char * const migratetype_names[MIGRATE_TYPES] = {
928 "Unmovable",
929 "Movable",
930 "Reclaimable",
931 "HighAtomic",
932#ifdef CONFIG_CMA
933 "CMA",
934#endif
935#ifdef CONFIG_MEMORY_ISOLATION
936 "Isolate",
937#endif
938};
939
940static void frag_show_print(struct seq_file *m, pg_data_t *pgdat, 927static void frag_show_print(struct seq_file *m, pg_data_t *pgdat,
941 struct zone *zone) 928 struct zone *zone)
942{ 929{