aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/trace
diff options
context:
space:
mode:
authorChen Yucong <slaoub@gmail.com>2014-08-06 19:07:09 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-08-06 21:01:20 -0400
commit2c51856c9bea9b20e4e5aab001971a5a6624db17 (patch)
tree6559eed9d2d642ac2d130d656f8e3689fa9dc103 /Documentation/trace
parentd0480be44a90af81a425f426c9107fb8f0899f65 (diff)
mm: trace-vmscan-postprocess.pl: report the number of file/anon pages respectively
Until now, the reporting from trace-vmscan-postprocess.pl is not very useful because we cannot directly use this script for checking the file/anon ratio of scanning. This patch aims to report respectively the number of file/anon pages which were scanned/reclaimed by kswapd or direct-reclaim. Sample output is usually something like the following. Summary Direct reclaims: 8823 Direct reclaim pages scanned: 2438797 Direct reclaim file pages scanned: 1315200 Direct reclaim anon pages scanned: 1123597 Direct reclaim pages reclaimed: 446139 Direct reclaim file pages reclaimed: 378668 Direct reclaim anon pages reclaimed: 67471 Direct reclaim write file sync I/O: 0 Direct reclaim write anon sync I/O: 0 Direct reclaim write file async I/O: 0 Direct reclaim write anon async I/O: 4240 Wake kswapd requests: 122310 Time stalled direct reclaim: 13.78 seconds Kswapd wakeups: 25817 Kswapd pages scanned: 170779115 Kswapd file pages scanned: 162725123 Kswapd anon pages scanned: 8053992 Kswapd pages reclaimed: 129065738 Kswapd file pages reclaimed: 128500930 Kswapd anon pages reclaimed: 564808 Kswapd reclaim write file sync I/O: 0 Kswapd reclaim write anon sync I/O: 0 Kswapd reclaim write file async I/O: 36 Kswapd reclaim write anon async I/O: 730730 Time kswapd awake: 1015.50 seconds Signed-off-by: Chen Yucong <slaoub@gmail.com> Cc: Mel Gorman <mel@csn.ul.ie> Cc: Johannes Weiner <hannes@cmpxchg.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation/trace')
-rw-r--r--Documentation/trace/postprocess/trace-vmscan-postprocess.pl53
1 files changed, 53 insertions, 0 deletions
diff --git a/Documentation/trace/postprocess/trace-vmscan-postprocess.pl b/Documentation/trace/postprocess/trace-vmscan-postprocess.pl
index 78c9a7b2b58f..8f961ef2b457 100644
--- a/Documentation/trace/postprocess/trace-vmscan-postprocess.pl
+++ b/Documentation/trace/postprocess/trace-vmscan-postprocess.pl
@@ -47,6 +47,10 @@ use constant HIGH_KSWAPD_REWAKEUP => 21;
47use constant HIGH_NR_SCANNED => 22; 47use constant HIGH_NR_SCANNED => 22;
48use constant HIGH_NR_TAKEN => 23; 48use constant HIGH_NR_TAKEN => 23;
49use constant HIGH_NR_RECLAIMED => 24; 49use constant HIGH_NR_RECLAIMED => 24;
50use constant HIGH_NR_FILE_SCANNED => 25;
51use constant HIGH_NR_ANON_SCANNED => 26;
52use constant HIGH_NR_FILE_RECLAIMED => 27;
53use constant HIGH_NR_ANON_RECLAIMED => 28;
50 54
51my %perprocesspid; 55my %perprocesspid;
52my %perprocess; 56my %perprocess;
@@ -56,14 +60,18 @@ my $opt_read_procstat;
56 60
57my $total_wakeup_kswapd; 61my $total_wakeup_kswapd;
58my ($total_direct_reclaim, $total_direct_nr_scanned); 62my ($total_direct_reclaim, $total_direct_nr_scanned);
63my ($total_direct_nr_file_scanned, $total_direct_nr_anon_scanned);
59my ($total_direct_latency, $total_kswapd_latency); 64my ($total_direct_latency, $total_kswapd_latency);
60my ($total_direct_nr_reclaimed); 65my ($total_direct_nr_reclaimed);
66my ($total_direct_nr_file_reclaimed, $total_direct_nr_anon_reclaimed);
61my ($total_direct_writepage_file_sync, $total_direct_writepage_file_async); 67my ($total_direct_writepage_file_sync, $total_direct_writepage_file_async);
62my ($total_direct_writepage_anon_sync, $total_direct_writepage_anon_async); 68my ($total_direct_writepage_anon_sync, $total_direct_writepage_anon_async);
63my ($total_kswapd_nr_scanned, $total_kswapd_wake); 69my ($total_kswapd_nr_scanned, $total_kswapd_wake);
70my ($total_kswapd_nr_file_scanned, $total_kswapd_nr_anon_scanned);
64my ($total_kswapd_writepage_file_sync, $total_kswapd_writepage_file_async); 71my ($total_kswapd_writepage_file_sync, $total_kswapd_writepage_file_async);
65my ($total_kswapd_writepage_anon_sync, $total_kswapd_writepage_anon_async); 72my ($total_kswapd_writepage_anon_sync, $total_kswapd_writepage_anon_async);
66my ($total_kswapd_nr_reclaimed); 73my ($total_kswapd_nr_reclaimed);
74my ($total_kswapd_nr_file_reclaimed, $total_kswapd_nr_anon_reclaimed);
67 75
68# Catch sigint and exit on request 76# Catch sigint and exit on request
69my $sigint_report = 0; 77my $sigint_report = 0;
@@ -374,6 +382,7 @@ EVENT_PROCESS:
374 } 382 }
375 my $isolate_mode = $1; 383 my $isolate_mode = $1;
376 my $nr_scanned = $4; 384 my $nr_scanned = $4;
385 my $file = $6;
377 386
378 # To closer match vmstat scanning statistics, only count isolate_both 387 # To closer match vmstat scanning statistics, only count isolate_both
379 # and isolate_inactive as scanning. isolate_active is rotation 388 # and isolate_inactive as scanning. isolate_active is rotation
@@ -382,6 +391,11 @@ EVENT_PROCESS:
382 # isolate_both == 3 391 # isolate_both == 3
383 if ($isolate_mode != 2) { 392 if ($isolate_mode != 2) {
384 $perprocesspid{$process_pid}->{HIGH_NR_SCANNED} += $nr_scanned; 393 $perprocesspid{$process_pid}->{HIGH_NR_SCANNED} += $nr_scanned;
394 if ($file == 1) {
395 $perprocesspid{$process_pid}->{HIGH_NR_FILE_SCANNED} += $nr_scanned;
396 } else {
397 $perprocesspid{$process_pid}->{HIGH_NR_ANON_SCANNED} += $nr_scanned;
398 }
385 } 399 }
386 } elsif ($tracepoint eq "mm_vmscan_lru_shrink_inactive") { 400 } elsif ($tracepoint eq "mm_vmscan_lru_shrink_inactive") {
387 $details = $6; 401 $details = $6;
@@ -391,8 +405,19 @@ EVENT_PROCESS:
391 print " $regex_lru_shrink_inactive/o\n"; 405 print " $regex_lru_shrink_inactive/o\n";
392 next; 406 next;
393 } 407 }
408
394 my $nr_reclaimed = $4; 409 my $nr_reclaimed = $4;
410 my $flags = $6;
411 my $file = 0;
412 if ($flags =~ /RECLAIM_WB_FILE/) {
413 $file = 1;
414 }
395 $perprocesspid{$process_pid}->{HIGH_NR_RECLAIMED} += $nr_reclaimed; 415 $perprocesspid{$process_pid}->{HIGH_NR_RECLAIMED} += $nr_reclaimed;
416 if ($file) {
417 $perprocesspid{$process_pid}->{HIGH_NR_FILE_RECLAIMED} += $nr_reclaimed;
418 } else {
419 $perprocesspid{$process_pid}->{HIGH_NR_ANON_RECLAIMED} += $nr_reclaimed;
420 }
396 } elsif ($tracepoint eq "mm_vmscan_writepage") { 421 } elsif ($tracepoint eq "mm_vmscan_writepage") {
397 $details = $6; 422 $details = $6;
398 if ($details !~ /$regex_writepage/o) { 423 if ($details !~ /$regex_writepage/o) {
@@ -493,7 +518,11 @@ sub dump_stats {
493 $total_direct_reclaim += $stats{$process_pid}->{MM_VMSCAN_DIRECT_RECLAIM_BEGIN}; 518 $total_direct_reclaim += $stats{$process_pid}->{MM_VMSCAN_DIRECT_RECLAIM_BEGIN};
494 $total_wakeup_kswapd += $stats{$process_pid}->{MM_VMSCAN_WAKEUP_KSWAPD}; 519 $total_wakeup_kswapd += $stats{$process_pid}->{MM_VMSCAN_WAKEUP_KSWAPD};
495 $total_direct_nr_scanned += $stats{$process_pid}->{HIGH_NR_SCANNED}; 520 $total_direct_nr_scanned += $stats{$process_pid}->{HIGH_NR_SCANNED};
521 $total_direct_nr_file_scanned += $stats{$process_pid}->{HIGH_NR_FILE_SCANNED};
522 $total_direct_nr_anon_scanned += $stats{$process_pid}->{HIGH_NR_ANON_SCANNED};
496 $total_direct_nr_reclaimed += $stats{$process_pid}->{HIGH_NR_RECLAIMED}; 523 $total_direct_nr_reclaimed += $stats{$process_pid}->{HIGH_NR_RECLAIMED};
524 $total_direct_nr_file_reclaimed += $stats{$process_pid}->{HIGH_NR_FILE_RECLAIMED};
525 $total_direct_nr_anon_reclaimed += $stats{$process_pid}->{HIGH_NR_ANON_RECLAIMED};
497 $total_direct_writepage_file_sync += $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_SYNC}; 526 $total_direct_writepage_file_sync += $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_SYNC};
498 $total_direct_writepage_anon_sync += $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_SYNC}; 527 $total_direct_writepage_anon_sync += $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_SYNC};
499 $total_direct_writepage_file_async += $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_ASYNC}; 528 $total_direct_writepage_file_async += $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_ASYNC};
@@ -513,7 +542,11 @@ sub dump_stats {
513 $stats{$process_pid}->{MM_VMSCAN_DIRECT_RECLAIM_BEGIN}, 542 $stats{$process_pid}->{MM_VMSCAN_DIRECT_RECLAIM_BEGIN},
514 $stats{$process_pid}->{MM_VMSCAN_WAKEUP_KSWAPD}, 543 $stats{$process_pid}->{MM_VMSCAN_WAKEUP_KSWAPD},
515 $stats{$process_pid}->{HIGH_NR_SCANNED}, 544 $stats{$process_pid}->{HIGH_NR_SCANNED},
545 $stats{$process_pid}->{HIGH_NR_FILE_SCANNED},
546 $stats{$process_pid}->{HIGH_NR_ANON_SCANNED},
516 $stats{$process_pid}->{HIGH_NR_RECLAIMED}, 547 $stats{$process_pid}->{HIGH_NR_RECLAIMED},
548 $stats{$process_pid}->{HIGH_NR_FILE_RECLAIMED},
549 $stats{$process_pid}->{HIGH_NR_ANON_RECLAIMED},
517 $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_SYNC} + $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_SYNC}, 550 $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_SYNC} + $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_SYNC},
518 $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_ASYNC} + $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_ASYNC}, 551 $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_ASYNC} + $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_ASYNC},
519 $this_reclaim_delay / 1000); 552 $this_reclaim_delay / 1000);
@@ -552,7 +585,11 @@ sub dump_stats {
552 585
553 $total_kswapd_wake += $stats{$process_pid}->{MM_VMSCAN_KSWAPD_WAKE}; 586 $total_kswapd_wake += $stats{$process_pid}->{MM_VMSCAN_KSWAPD_WAKE};
554 $total_kswapd_nr_scanned += $stats{$process_pid}->{HIGH_NR_SCANNED}; 587 $total_kswapd_nr_scanned += $stats{$process_pid}->{HIGH_NR_SCANNED};
588 $total_kswapd_nr_file_scanned += $stats{$process_pid}->{HIGH_NR_FILE_SCANNED};
589 $total_kswapd_nr_anon_scanned += $stats{$process_pid}->{HIGH_NR_ANON_SCANNED};
555 $total_kswapd_nr_reclaimed += $stats{$process_pid}->{HIGH_NR_RECLAIMED}; 590 $total_kswapd_nr_reclaimed += $stats{$process_pid}->{HIGH_NR_RECLAIMED};
591 $total_kswapd_nr_file_reclaimed += $stats{$process_pid}->{HIGH_NR_FILE_RECLAIMED};
592 $total_kswapd_nr_anon_reclaimed += $stats{$process_pid}->{HIGH_NR_ANON_RECLAIMED};
556 $total_kswapd_writepage_file_sync += $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_SYNC}; 593 $total_kswapd_writepage_file_sync += $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_SYNC};
557 $total_kswapd_writepage_anon_sync += $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_SYNC}; 594 $total_kswapd_writepage_anon_sync += $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_SYNC};
558 $total_kswapd_writepage_file_async += $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_ASYNC}; 595 $total_kswapd_writepage_file_async += $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_ASYNC};
@@ -563,7 +600,11 @@ sub dump_stats {
563 $stats{$process_pid}->{MM_VMSCAN_KSWAPD_WAKE}, 600 $stats{$process_pid}->{MM_VMSCAN_KSWAPD_WAKE},
564 $stats{$process_pid}->{HIGH_KSWAPD_REWAKEUP}, 601 $stats{$process_pid}->{HIGH_KSWAPD_REWAKEUP},
565 $stats{$process_pid}->{HIGH_NR_SCANNED}, 602 $stats{$process_pid}->{HIGH_NR_SCANNED},
603 $stats{$process_pid}->{HIGH_NR_FILE_SCANNED},
604 $stats{$process_pid}->{HIGH_NR_ANON_SCANNED},
566 $stats{$process_pid}->{HIGH_NR_RECLAIMED}, 605 $stats{$process_pid}->{HIGH_NR_RECLAIMED},
606 $stats{$process_pid}->{HIGH_NR_FILE_RECLAIMED},
607 $stats{$process_pid}->{HIGH_NR_ANON_RECLAIMED},
567 $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_SYNC} + $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_SYNC}, 608 $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_SYNC} + $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_SYNC},
568 $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_ASYNC} + $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_ASYNC}); 609 $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_ASYNC} + $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_ASYNC});
569 610
@@ -594,7 +635,11 @@ sub dump_stats {
594 print "\nSummary\n"; 635 print "\nSummary\n";
595 print "Direct reclaims: $total_direct_reclaim\n"; 636 print "Direct reclaims: $total_direct_reclaim\n";
596 print "Direct reclaim pages scanned: $total_direct_nr_scanned\n"; 637 print "Direct reclaim pages scanned: $total_direct_nr_scanned\n";
638 print "Direct reclaim file pages scanned: $total_direct_nr_file_scanned\n";
639 print "Direct reclaim anon pages scanned: $total_direct_nr_anon_scanned\n";
597 print "Direct reclaim pages reclaimed: $total_direct_nr_reclaimed\n"; 640 print "Direct reclaim pages reclaimed: $total_direct_nr_reclaimed\n";
641 print "Direct reclaim file pages reclaimed: $total_direct_nr_file_reclaimed\n";
642 print "Direct reclaim anon pages reclaimed: $total_direct_nr_anon_reclaimed\n";
598 print "Direct reclaim write file sync I/O: $total_direct_writepage_file_sync\n"; 643 print "Direct reclaim write file sync I/O: $total_direct_writepage_file_sync\n";
599 print "Direct reclaim write anon sync I/O: $total_direct_writepage_anon_sync\n"; 644 print "Direct reclaim write anon sync I/O: $total_direct_writepage_anon_sync\n";
600 print "Direct reclaim write file async I/O: $total_direct_writepage_file_async\n"; 645 print "Direct reclaim write file async I/O: $total_direct_writepage_file_async\n";
@@ -604,7 +649,11 @@ sub dump_stats {
604 print "\n"; 649 print "\n";
605 print "Kswapd wakeups: $total_kswapd_wake\n"; 650 print "Kswapd wakeups: $total_kswapd_wake\n";
606 print "Kswapd pages scanned: $total_kswapd_nr_scanned\n"; 651 print "Kswapd pages scanned: $total_kswapd_nr_scanned\n";
652 print "Kswapd file pages scanned: $total_kswapd_nr_file_scanned\n";
653 print "Kswapd anon pages scanned: $total_kswapd_nr_anon_scanned\n";
607 print "Kswapd pages reclaimed: $total_kswapd_nr_reclaimed\n"; 654 print "Kswapd pages reclaimed: $total_kswapd_nr_reclaimed\n";
655 print "Kswapd file pages reclaimed: $total_kswapd_nr_file_reclaimed\n";
656 print "Kswapd anon pages reclaimed: $total_kswapd_nr_anon_reclaimed\n";
608 print "Kswapd reclaim write file sync I/O: $total_kswapd_writepage_file_sync\n"; 657 print "Kswapd reclaim write file sync I/O: $total_kswapd_writepage_file_sync\n";
609 print "Kswapd reclaim write anon sync I/O: $total_kswapd_writepage_anon_sync\n"; 658 print "Kswapd reclaim write anon sync I/O: $total_kswapd_writepage_anon_sync\n";
610 print "Kswapd reclaim write file async I/O: $total_kswapd_writepage_file_async\n"; 659 print "Kswapd reclaim write file async I/O: $total_kswapd_writepage_file_async\n";
@@ -629,7 +678,11 @@ sub aggregate_perprocesspid() {
629 $perprocess{$process}->{MM_VMSCAN_WAKEUP_KSWAPD} += $perprocesspid{$process_pid}->{MM_VMSCAN_WAKEUP_KSWAPD}; 678 $perprocess{$process}->{MM_VMSCAN_WAKEUP_KSWAPD} += $perprocesspid{$process_pid}->{MM_VMSCAN_WAKEUP_KSWAPD};
630 $perprocess{$process}->{HIGH_KSWAPD_REWAKEUP} += $perprocesspid{$process_pid}->{HIGH_KSWAPD_REWAKEUP}; 679 $perprocess{$process}->{HIGH_KSWAPD_REWAKEUP} += $perprocesspid{$process_pid}->{HIGH_KSWAPD_REWAKEUP};
631 $perprocess{$process}->{HIGH_NR_SCANNED} += $perprocesspid{$process_pid}->{HIGH_NR_SCANNED}; 680 $perprocess{$process}->{HIGH_NR_SCANNED} += $perprocesspid{$process_pid}->{HIGH_NR_SCANNED};
681 $perprocess{$process}->{HIGH_NR_FILE_SCANNED} += $perprocesspid{$process_pid}->{HIGH_NR_FILE_SCANNED};
682 $perprocess{$process}->{HIGH_NR_ANON_SCANNED} += $perprocesspid{$process_pid}->{HIGH_NR_ANON_SCANNED};
632 $perprocess{$process}->{HIGH_NR_RECLAIMED} += $perprocesspid{$process_pid}->{HIGH_NR_RECLAIMED}; 683 $perprocess{$process}->{HIGH_NR_RECLAIMED} += $perprocesspid{$process_pid}->{HIGH_NR_RECLAIMED};
684 $perprocess{$process}->{HIGH_NR_FILE_RECLAIMED} += $perprocesspid{$process_pid}->{HIGH_NR_FILE_RECLAIMED};
685 $perprocess{$process}->{HIGH_NR_ANON_RECLAIMED} += $perprocesspid{$process_pid}->{HIGH_NR_ANON_RECLAIMED};
633 $perprocess{$process}->{MM_VMSCAN_WRITEPAGE_FILE_SYNC} += $perprocesspid{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_SYNC}; 686 $perprocess{$process}->{MM_VMSCAN_WRITEPAGE_FILE_SYNC} += $perprocesspid{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_SYNC};
634 $perprocess{$process}->{MM_VMSCAN_WRITEPAGE_ANON_SYNC} += $perprocesspid{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_SYNC}; 687 $perprocess{$process}->{MM_VMSCAN_WRITEPAGE_ANON_SYNC} += $perprocesspid{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_SYNC};
635 $perprocess{$process}->{MM_VMSCAN_WRITEPAGE_FILE_ASYNC} += $perprocesspid{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_ASYNC}; 688 $perprocess{$process}->{MM_VMSCAN_WRITEPAGE_FILE_ASYNC} += $perprocesspid{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_ASYNC};