diff options
author | Joonsoo Kim <iamjoonsoo.kim@lge.com> | 2016-10-07 19:58:21 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-10-07 21:46:27 -0400 |
commit | e2f612e673f61931b2fe62722832cf5fcf6b3313 (patch) | |
tree | abad15b67ee8636473626e36303cc2deb8ff3420 | |
parent | f1c1e9f7b5b3ddce6b4f1986939ec87b27515086 (diff) |
mm/page_owner: move page_owner specific function to page_owner.c
There is no reason that page_owner specific function resides on
vmstat.c.
Link: http://lkml.kernel.org/r/1471315879-32294-4-git-send-email-iamjoonsoo.kim@lge.com
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Michal Hocko <mhocko@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | include/linux/page_owner.h | 2 | ||||
-rw-r--r-- | mm/page_owner.c | 77 | ||||
-rw-r--r-- | mm/vmstat.c | 79 |
3 files changed, 79 insertions, 79 deletions
diff --git a/include/linux/page_owner.h b/include/linux/page_owner.h index 30583ab0ffb1..2be728d156b5 100644 --- a/include/linux/page_owner.h +++ b/include/linux/page_owner.h | |||
@@ -14,6 +14,8 @@ extern void __split_page_owner(struct page *page, unsigned int order); | |||
14 | extern void __copy_page_owner(struct page *oldpage, struct page *newpage); | 14 | extern void __copy_page_owner(struct page *oldpage, struct page *newpage); |
15 | extern void __set_page_owner_migrate_reason(struct page *page, int reason); | 15 | extern void __set_page_owner_migrate_reason(struct page *page, int reason); |
16 | extern void __dump_page_owner(struct page *page); | 16 | extern void __dump_page_owner(struct page *page); |
17 | extern void pagetypeinfo_showmixedcount_print(struct seq_file *m, | ||
18 | pg_data_t *pgdat, struct zone *zone); | ||
17 | 19 | ||
18 | static inline void reset_page_owner(struct page *page, unsigned int order) | 20 | static inline void reset_page_owner(struct page *page, unsigned int order) |
19 | { | 21 | { |
diff --git a/mm/page_owner.c b/mm/page_owner.c index ec6dc1886f71..0f4246d109a0 100644 --- a/mm/page_owner.c +++ b/mm/page_owner.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/jump_label.h> | 8 | #include <linux/jump_label.h> |
9 | #include <linux/migrate.h> | 9 | #include <linux/migrate.h> |
10 | #include <linux/stackdepot.h> | 10 | #include <linux/stackdepot.h> |
11 | #include <linux/seq_file.h> | ||
11 | 12 | ||
12 | #include "internal.h" | 13 | #include "internal.h" |
13 | 14 | ||
@@ -214,6 +215,82 @@ void __copy_page_owner(struct page *oldpage, struct page *newpage) | |||
214 | __set_bit(PAGE_EXT_OWNER, &new_ext->flags); | 215 | __set_bit(PAGE_EXT_OWNER, &new_ext->flags); |
215 | } | 216 | } |
216 | 217 | ||
218 | void pagetypeinfo_showmixedcount_print(struct seq_file *m, | ||
219 | pg_data_t *pgdat, struct zone *zone) | ||
220 | { | ||
221 | struct page *page; | ||
222 | struct page_ext *page_ext; | ||
223 | unsigned long pfn = zone->zone_start_pfn, block_end_pfn; | ||
224 | unsigned long end_pfn = pfn + zone->spanned_pages; | ||
225 | unsigned long count[MIGRATE_TYPES] = { 0, }; | ||
226 | int pageblock_mt, page_mt; | ||
227 | int i; | ||
228 | |||
229 | /* Scan block by block. First and last block may be incomplete */ | ||
230 | pfn = zone->zone_start_pfn; | ||
231 | |||
232 | /* | ||
233 | * Walk the zone in pageblock_nr_pages steps. If a page block spans | ||
234 | * a zone boundary, it will be double counted between zones. This does | ||
235 | * not matter as the mixed block count will still be correct | ||
236 | */ | ||
237 | for (; pfn < end_pfn; ) { | ||
238 | if (!pfn_valid(pfn)) { | ||
239 | pfn = ALIGN(pfn + 1, MAX_ORDER_NR_PAGES); | ||
240 | continue; | ||
241 | } | ||
242 | |||
243 | block_end_pfn = ALIGN(pfn + 1, pageblock_nr_pages); | ||
244 | block_end_pfn = min(block_end_pfn, end_pfn); | ||
245 | |||
246 | page = pfn_to_page(pfn); | ||
247 | pageblock_mt = get_pageblock_migratetype(page); | ||
248 | |||
249 | for (; pfn < block_end_pfn; pfn++) { | ||
250 | if (!pfn_valid_within(pfn)) | ||
251 | continue; | ||
252 | |||
253 | page = pfn_to_page(pfn); | ||
254 | |||
255 | if (page_zone(page) != zone) | ||
256 | continue; | ||
257 | |||
258 | if (PageBuddy(page)) { | ||
259 | pfn += (1UL << page_order(page)) - 1; | ||
260 | continue; | ||
261 | } | ||
262 | |||
263 | if (PageReserved(page)) | ||
264 | continue; | ||
265 | |||
266 | page_ext = lookup_page_ext(page); | ||
267 | if (unlikely(!page_ext)) | ||
268 | continue; | ||
269 | |||
270 | if (!test_bit(PAGE_EXT_OWNER, &page_ext->flags)) | ||
271 | continue; | ||
272 | |||
273 | page_mt = gfpflags_to_migratetype(page_ext->gfp_mask); | ||
274 | if (pageblock_mt != page_mt) { | ||
275 | if (is_migrate_cma(pageblock_mt)) | ||
276 | count[MIGRATE_MOVABLE]++; | ||
277 | else | ||
278 | count[pageblock_mt]++; | ||
279 | |||
280 | pfn = block_end_pfn; | ||
281 | break; | ||
282 | } | ||
283 | pfn += (1UL << page_ext->order) - 1; | ||
284 | } | ||
285 | } | ||
286 | |||
287 | /* Print counts */ | ||
288 | seq_printf(m, "Node %d, zone %8s ", pgdat->node_id, zone->name); | ||
289 | for (i = 0; i < MIGRATE_TYPES; i++) | ||
290 | seq_printf(m, "%12lu ", count[i]); | ||
291 | seq_putc(m, '\n'); | ||
292 | } | ||
293 | |||
217 | static ssize_t | 294 | static ssize_t |
218 | print_page_owner(char __user *buf, size_t count, unsigned long pfn, | 295 | print_page_owner(char __user *buf, size_t count, unsigned long pfn, |
219 | struct page *page, struct page_ext *page_ext, | 296 | struct page *page, struct page_ext *page_ext, |
diff --git a/mm/vmstat.c b/mm/vmstat.c index 89cec42d19ff..dc04e76c7950 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c | |||
@@ -1254,85 +1254,6 @@ static int pagetypeinfo_showblockcount(struct seq_file *m, void *arg) | |||
1254 | return 0; | 1254 | return 0; |
1255 | } | 1255 | } |
1256 | 1256 | ||
1257 | #ifdef CONFIG_PAGE_OWNER | ||
1258 | static void pagetypeinfo_showmixedcount_print(struct seq_file *m, | ||
1259 | pg_data_t *pgdat, | ||
1260 | struct zone *zone) | ||
1261 | { | ||
1262 | struct page *page; | ||
1263 | struct page_ext *page_ext; | ||
1264 | unsigned long pfn = zone->zone_start_pfn, block_end_pfn; | ||
1265 | unsigned long end_pfn = pfn + zone->spanned_pages; | ||
1266 | unsigned long count[MIGRATE_TYPES] = { 0, }; | ||
1267 | int pageblock_mt, page_mt; | ||
1268 | int i; | ||
1269 | |||
1270 | /* Scan block by block. First and last block may be incomplete */ | ||
1271 | pfn = zone->zone_start_pfn; | ||
1272 | |||
1273 | /* | ||
1274 | * Walk the zone in pageblock_nr_pages steps. If a page block spans | ||
1275 | * a zone boundary, it will be double counted between zones. This does | ||
1276 | * not matter as the mixed block count will still be correct | ||
1277 | */ | ||
1278 | for (; pfn < end_pfn; ) { | ||
1279 | if (!pfn_valid(pfn)) { | ||
1280 | pfn = ALIGN(pfn + 1, MAX_ORDER_NR_PAGES); | ||
1281 | continue; | ||
1282 | } | ||
1283 | |||
1284 | block_end_pfn = ALIGN(pfn + 1, pageblock_nr_pages); | ||
1285 | block_end_pfn = min(block_end_pfn, end_pfn); | ||
1286 | |||
1287 | page = pfn_to_page(pfn); | ||
1288 | pageblock_mt = get_pageblock_migratetype(page); | ||
1289 | |||
1290 | for (; pfn < block_end_pfn; pfn++) { | ||
1291 | if (!pfn_valid_within(pfn)) | ||
1292 | continue; | ||
1293 | |||
1294 | page = pfn_to_page(pfn); | ||
1295 | |||
1296 | if (page_zone(page) != zone) | ||
1297 | continue; | ||
1298 | |||
1299 | if (PageBuddy(page)) { | ||
1300 | pfn += (1UL << page_order(page)) - 1; | ||
1301 | continue; | ||
1302 | } | ||
1303 | |||
1304 | if (PageReserved(page)) | ||
1305 | continue; | ||
1306 | |||
1307 | page_ext = lookup_page_ext(page); | ||
1308 | if (unlikely(!page_ext)) | ||
1309 | continue; | ||
1310 | |||
1311 | if (!test_bit(PAGE_EXT_OWNER, &page_ext->flags)) | ||
1312 | continue; | ||
1313 | |||
1314 | page_mt = gfpflags_to_migratetype(page_ext->gfp_mask); | ||
1315 | if (pageblock_mt != page_mt) { | ||
1316 | if (is_migrate_cma(pageblock_mt)) | ||
1317 | count[MIGRATE_MOVABLE]++; | ||
1318 | else | ||
1319 | count[pageblock_mt]++; | ||
1320 | |||
1321 | pfn = block_end_pfn; | ||
1322 | break; | ||
1323 | } | ||
1324 | pfn += (1UL << page_ext->order) - 1; | ||
1325 | } | ||
1326 | } | ||
1327 | |||
1328 | /* Print counts */ | ||
1329 | seq_printf(m, "Node %d, zone %8s ", pgdat->node_id, zone->name); | ||
1330 | for (i = 0; i < MIGRATE_TYPES; i++) | ||
1331 | seq_printf(m, "%12lu ", count[i]); | ||
1332 | seq_putc(m, '\n'); | ||
1333 | } | ||
1334 | #endif /* CONFIG_PAGE_OWNER */ | ||
1335 | |||
1336 | /* | 1257 | /* |
1337 | * Print out the number of pageblocks for each migratetype that contain pages | 1258 | * Print out the number of pageblocks for each migratetype that contain pages |
1338 | * of other types. This gives an indication of how well fallbacks are being | 1259 | * of other types. This gives an indication of how well fallbacks are being |