Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Joonsoo Kim and committed by
Linus Torvalds
e2f612e6 f1c1e9f7

+79 -79
+2
include/linux/page_owner.h
··· 14 14 extern void __copy_page_owner(struct page *oldpage, struct page *newpage); 15 15 extern void __set_page_owner_migrate_reason(struct page *page, int reason); 16 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 20 static inline void reset_page_owner(struct page *page, unsigned int order) 19 21 {
+77
mm/page_owner.c
··· 8 8 #include <linux/jump_label.h> 9 9 #include <linux/migrate.h> 10 10 #include <linux/stackdepot.h> 11 + #include <linux/seq_file.h> 11 12 12 13 #include "internal.h" 13 14 ··· 213 212 * the new page, which will be freed. 214 213 */ 215 214 __set_bit(PAGE_EXT_OWNER, &new_ext->flags); 215 + } 216 + 217 + void pagetypeinfo_showmixedcount_print(struct seq_file *m, 218 + pg_data_t *pgdat, struct zone *zone) 219 + { 220 + struct page *page; 221 + struct page_ext *page_ext; 222 + unsigned long pfn = zone->zone_start_pfn, block_end_pfn; 223 + unsigned long end_pfn = pfn + zone->spanned_pages; 224 + unsigned long count[MIGRATE_TYPES] = { 0, }; 225 + int pageblock_mt, page_mt; 226 + int i; 227 + 228 + /* Scan block by block. First and last block may be incomplete */ 229 + pfn = zone->zone_start_pfn; 230 + 231 + /* 232 + * Walk the zone in pageblock_nr_pages steps. If a page block spans 233 + * a zone boundary, it will be double counted between zones. This does 234 + * not matter as the mixed block count will still be correct 235 + */ 236 + for (; pfn < end_pfn; ) { 237 + if (!pfn_valid(pfn)) { 238 + pfn = ALIGN(pfn + 1, MAX_ORDER_NR_PAGES); 239 + continue; 240 + } 241 + 242 + block_end_pfn = ALIGN(pfn + 1, pageblock_nr_pages); 243 + block_end_pfn = min(block_end_pfn, end_pfn); 244 + 245 + page = pfn_to_page(pfn); 246 + pageblock_mt = get_pageblock_migratetype(page); 247 + 248 + for (; pfn < block_end_pfn; pfn++) { 249 + if (!pfn_valid_within(pfn)) 250 + continue; 251 + 252 + page = pfn_to_page(pfn); 253 + 254 + if (page_zone(page) != zone) 255 + continue; 256 + 257 + if (PageBuddy(page)) { 258 + pfn += (1UL << page_order(page)) - 1; 259 + continue; 260 + } 261 + 262 + if (PageReserved(page)) 263 + continue; 264 + 265 + page_ext = lookup_page_ext(page); 266 + if (unlikely(!page_ext)) 267 + continue; 268 + 269 + if (!test_bit(PAGE_EXT_OWNER, &page_ext->flags)) 270 + continue; 271 + 272 + page_mt = gfpflags_to_migratetype(page_ext->gfp_mask); 273 + if (pageblock_mt != page_mt) { 274 + if (is_migrate_cma(pageblock_mt)) 275 + count[MIGRATE_MOVABLE]++; 276 + else 277 + count[pageblock_mt]++; 278 + 279 + pfn = block_end_pfn; 280 + break; 281 + } 282 + pfn += (1UL << page_ext->order) - 1; 283 + } 284 + } 285 + 286 + /* Print counts */ 287 + seq_printf(m, "Node %d, zone %8s ", pgdat->node_id, zone->name); 288 + for (i = 0; i < MIGRATE_TYPES; i++) 289 + seq_printf(m, "%12lu ", count[i]); 290 + seq_putc(m, '\n'); 216 291 } 217 292 218 293 static ssize_t
-79
mm/vmstat.c
··· 1254 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 1258 * Print out the number of pageblocks for each migratetype that contain pages 1338 1259 * of other types. This gives an indication of how well fallbacks are being