diff options
Diffstat (limited to 'Documentation/trace/postprocess')
-rw-r--r-- | Documentation/trace/postprocess/trace-vmscan-postprocess.pl | 50 |
1 files changed, 39 insertions, 11 deletions
diff --git a/Documentation/trace/postprocess/trace-vmscan-postprocess.pl b/Documentation/trace/postprocess/trace-vmscan-postprocess.pl index 1b55146d1c8d..12cecc83cd91 100644 --- a/Documentation/trace/postprocess/trace-vmscan-postprocess.pl +++ b/Documentation/trace/postprocess/trace-vmscan-postprocess.pl | |||
@@ -46,7 +46,7 @@ use constant HIGH_KSWAPD_LATENCY => 20; | |||
46 | use constant HIGH_KSWAPD_REWAKEUP => 21; | 46 | use constant HIGH_KSWAPD_REWAKEUP => 21; |
47 | use constant HIGH_NR_SCANNED => 22; | 47 | use constant HIGH_NR_SCANNED => 22; |
48 | use constant HIGH_NR_TAKEN => 23; | 48 | use constant HIGH_NR_TAKEN => 23; |
49 | use constant HIGH_NR_RECLAIM => 24; | 49 | use constant HIGH_NR_RECLAIMED => 24; |
50 | use constant HIGH_NR_CONTIG_DIRTY => 25; | 50 | use constant HIGH_NR_CONTIG_DIRTY => 25; |
51 | 51 | ||
52 | my %perprocesspid; | 52 | my %perprocesspid; |
@@ -58,11 +58,13 @@ my $opt_read_procstat; | |||
58 | my $total_wakeup_kswapd; | 58 | my $total_wakeup_kswapd; |
59 | my ($total_direct_reclaim, $total_direct_nr_scanned); | 59 | my ($total_direct_reclaim, $total_direct_nr_scanned); |
60 | my ($total_direct_latency, $total_kswapd_latency); | 60 | my ($total_direct_latency, $total_kswapd_latency); |
61 | my ($total_direct_nr_reclaimed); | ||
61 | my ($total_direct_writepage_file_sync, $total_direct_writepage_file_async); | 62 | my ($total_direct_writepage_file_sync, $total_direct_writepage_file_async); |
62 | my ($total_direct_writepage_anon_sync, $total_direct_writepage_anon_async); | 63 | my ($total_direct_writepage_anon_sync, $total_direct_writepage_anon_async); |
63 | my ($total_kswapd_nr_scanned, $total_kswapd_wake); | 64 | my ($total_kswapd_nr_scanned, $total_kswapd_wake); |
64 | my ($total_kswapd_writepage_file_sync, $total_kswapd_writepage_file_async); | 65 | my ($total_kswapd_writepage_file_sync, $total_kswapd_writepage_file_async); |
65 | my ($total_kswapd_writepage_anon_sync, $total_kswapd_writepage_anon_async); | 66 | my ($total_kswapd_writepage_anon_sync, $total_kswapd_writepage_anon_async); |
67 | my ($total_kswapd_nr_reclaimed); | ||
66 | 68 | ||
67 | # Catch sigint and exit on request | 69 | # Catch sigint and exit on request |
68 | my $sigint_report = 0; | 70 | my $sigint_report = 0; |
@@ -104,7 +106,7 @@ my $regex_kswapd_wake_default = 'nid=([0-9]*) order=([0-9]*)'; | |||
104 | my $regex_kswapd_sleep_default = 'nid=([0-9]*)'; | 106 | my $regex_kswapd_sleep_default = 'nid=([0-9]*)'; |
105 | my $regex_wakeup_kswapd_default = 'nid=([0-9]*) zid=([0-9]*) order=([0-9]*)'; | 107 | my $regex_wakeup_kswapd_default = 'nid=([0-9]*) zid=([0-9]*) order=([0-9]*)'; |
106 | my $regex_lru_isolate_default = 'isolate_mode=([0-9]*) order=([0-9]*) nr_requested=([0-9]*) nr_scanned=([0-9]*) nr_taken=([0-9]*) contig_taken=([0-9]*) contig_dirty=([0-9]*) contig_failed=([0-9]*)'; | 108 | my $regex_lru_isolate_default = 'isolate_mode=([0-9]*) order=([0-9]*) nr_requested=([0-9]*) nr_scanned=([0-9]*) nr_taken=([0-9]*) contig_taken=([0-9]*) contig_dirty=([0-9]*) contig_failed=([0-9]*)'; |
107 | my $regex_lru_shrink_inactive_default = 'lru=([A-Z_]*) nr_scanned=([0-9]*) nr_reclaimed=([0-9]*) priority=([0-9]*)'; | 109 | my $regex_lru_shrink_inactive_default = 'nid=([0-9]*) zid=([0-9]*) nr_scanned=([0-9]*) nr_reclaimed=([0-9]*) priority=([0-9]*) flags=([A-Z_|]*)'; |
108 | my $regex_lru_shrink_active_default = 'lru=([A-Z_]*) nr_scanned=([0-9]*) nr_rotated=([0-9]*) priority=([0-9]*)'; | 110 | my $regex_lru_shrink_active_default = 'lru=([A-Z_]*) nr_scanned=([0-9]*) nr_rotated=([0-9]*) priority=([0-9]*)'; |
109 | my $regex_writepage_default = 'page=([0-9a-f]*) pfn=([0-9]*) flags=([A-Z_|]*)'; | 111 | my $regex_writepage_default = 'page=([0-9a-f]*) pfn=([0-9]*) flags=([A-Z_|]*)'; |
110 | 112 | ||
@@ -203,8 +205,8 @@ $regex_lru_shrink_inactive = generate_traceevent_regex( | |||
203 | "vmscan/mm_vmscan_lru_shrink_inactive", | 205 | "vmscan/mm_vmscan_lru_shrink_inactive", |
204 | $regex_lru_shrink_inactive_default, | 206 | $regex_lru_shrink_inactive_default, |
205 | "nid", "zid", | 207 | "nid", "zid", |
206 | "lru", | 208 | "nr_scanned", "nr_reclaimed", "priority", |
207 | "nr_scanned", "nr_reclaimed", "priority"); | 209 | "flags"); |
208 | $regex_lru_shrink_active = generate_traceevent_regex( | 210 | $regex_lru_shrink_active = generate_traceevent_regex( |
209 | "vmscan/mm_vmscan_lru_shrink_active", | 211 | "vmscan/mm_vmscan_lru_shrink_active", |
210 | $regex_lru_shrink_active_default, | 212 | $regex_lru_shrink_active_default, |
@@ -371,10 +373,29 @@ EVENT_PROCESS: | |||
371 | print " $regex_lru_isolate/o\n"; | 373 | print " $regex_lru_isolate/o\n"; |
372 | next; | 374 | next; |
373 | } | 375 | } |
376 | my $isolate_mode = $1; | ||
374 | my $nr_scanned = $4; | 377 | my $nr_scanned = $4; |
375 | my $nr_contig_dirty = $7; | 378 | my $nr_contig_dirty = $7; |
376 | $perprocesspid{$process_pid}->{HIGH_NR_SCANNED} += $nr_scanned; | 379 | |
380 | # To closer match vmstat scanning statistics, only count isolate_both | ||
381 | # and isolate_inactive as scanning. isolate_active is rotation | ||
382 | # isolate_inactive == 0 | ||
383 | # isolate_active == 1 | ||
384 | # isolate_both == 2 | ||
385 | if ($isolate_mode != 1) { | ||
386 | $perprocesspid{$process_pid}->{HIGH_NR_SCANNED} += $nr_scanned; | ||
387 | } | ||
377 | $perprocesspid{$process_pid}->{HIGH_NR_CONTIG_DIRTY} += $nr_contig_dirty; | 388 | $perprocesspid{$process_pid}->{HIGH_NR_CONTIG_DIRTY} += $nr_contig_dirty; |
389 | } elsif ($tracepoint eq "mm_vmscan_lru_shrink_inactive") { | ||
390 | $details = $5; | ||
391 | if ($details !~ /$regex_lru_shrink_inactive/o) { | ||
392 | print "WARNING: Failed to parse mm_vmscan_lru_shrink_inactive as expected\n"; | ||
393 | print " $details\n"; | ||
394 | print " $regex_lru_shrink_inactive/o\n"; | ||
395 | next; | ||
396 | } | ||
397 | my $nr_reclaimed = $4; | ||
398 | $perprocesspid{$process_pid}->{HIGH_NR_RECLAIMED} += $nr_reclaimed; | ||
378 | } elsif ($tracepoint eq "mm_vmscan_writepage") { | 399 | } elsif ($tracepoint eq "mm_vmscan_writepage") { |
379 | $details = $5; | 400 | $details = $5; |
380 | if ($details !~ /$regex_writepage/o) { | 401 | if ($details !~ /$regex_writepage/o) { |
@@ -464,8 +485,8 @@ sub dump_stats { | |||
464 | 485 | ||
465 | # Print out process activity | 486 | # Print out process activity |
466 | printf("\n"); | 487 | printf("\n"); |
467 | printf("%-" . $max_strlen . "s %8s %10s %8s %8s %8s %8s %8s\n", "Process", "Direct", "Wokeup", "Pages", "Pages", "Pages", "Time"); | 488 | printf("%-" . $max_strlen . "s %8s %10s %8s %8s %8s %8s %8s %8s\n", "Process", "Direct", "Wokeup", "Pages", "Pages", "Pages", "Pages", "Time"); |
468 | printf("%-" . $max_strlen . "s %8s %10s %8s %8s %8s %8s %8s\n", "details", "Rclms", "Kswapd", "Scanned", "Sync-IO", "ASync-IO", "Stalled"); | 489 | printf("%-" . $max_strlen . "s %8s %10s %8s %8s %8s %8s %8s %8s\n", "details", "Rclms", "Kswapd", "Scanned", "Rclmed", "Sync-IO", "ASync-IO", "Stalled"); |
469 | foreach $process_pid (keys %stats) { | 490 | foreach $process_pid (keys %stats) { |
470 | 491 | ||
471 | if (!$stats{$process_pid}->{MM_VMSCAN_DIRECT_RECLAIM_BEGIN}) { | 492 | if (!$stats{$process_pid}->{MM_VMSCAN_DIRECT_RECLAIM_BEGIN}) { |
@@ -475,6 +496,7 @@ sub dump_stats { | |||
475 | $total_direct_reclaim += $stats{$process_pid}->{MM_VMSCAN_DIRECT_RECLAIM_BEGIN}; | 496 | $total_direct_reclaim += $stats{$process_pid}->{MM_VMSCAN_DIRECT_RECLAIM_BEGIN}; |
476 | $total_wakeup_kswapd += $stats{$process_pid}->{MM_VMSCAN_WAKEUP_KSWAPD}; | 497 | $total_wakeup_kswapd += $stats{$process_pid}->{MM_VMSCAN_WAKEUP_KSWAPD}; |
477 | $total_direct_nr_scanned += $stats{$process_pid}->{HIGH_NR_SCANNED}; | 498 | $total_direct_nr_scanned += $stats{$process_pid}->{HIGH_NR_SCANNED}; |
499 | $total_direct_nr_reclaimed += $stats{$process_pid}->{HIGH_NR_RECLAIMED}; | ||
478 | $total_direct_writepage_file_sync += $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_SYNC}; | 500 | $total_direct_writepage_file_sync += $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_SYNC}; |
479 | $total_direct_writepage_anon_sync += $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_SYNC}; | 501 | $total_direct_writepage_anon_sync += $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_SYNC}; |
480 | $total_direct_writepage_file_async += $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_ASYNC}; | 502 | $total_direct_writepage_file_async += $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_ASYNC}; |
@@ -489,11 +511,12 @@ sub dump_stats { | |||
489 | $index++; | 511 | $index++; |
490 | } | 512 | } |
491 | 513 | ||
492 | printf("%-" . $max_strlen . "s %8d %10d %8u %8u %8u %8.3f", | 514 | printf("%-" . $max_strlen . "s %8d %10d %8u %8u %8u %8u %8.3f", |
493 | $process_pid, | 515 | $process_pid, |
494 | $stats{$process_pid}->{MM_VMSCAN_DIRECT_RECLAIM_BEGIN}, | 516 | $stats{$process_pid}->{MM_VMSCAN_DIRECT_RECLAIM_BEGIN}, |
495 | $stats{$process_pid}->{MM_VMSCAN_WAKEUP_KSWAPD}, | 517 | $stats{$process_pid}->{MM_VMSCAN_WAKEUP_KSWAPD}, |
496 | $stats{$process_pid}->{HIGH_NR_SCANNED}, | 518 | $stats{$process_pid}->{HIGH_NR_SCANNED}, |
519 | $stats{$process_pid}->{HIGH_NR_RECLAIMED}, | ||
497 | $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_SYNC} + $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_SYNC}, | 520 | $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_SYNC} + $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_SYNC}, |
498 | $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_ASYNC} + $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_ASYNC}, | 521 | $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_ASYNC} + $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_ASYNC}, |
499 | $this_reclaim_delay / 1000); | 522 | $this_reclaim_delay / 1000); |
@@ -529,8 +552,8 @@ sub dump_stats { | |||
529 | 552 | ||
530 | # Print out kswapd activity | 553 | # Print out kswapd activity |
531 | printf("\n"); | 554 | printf("\n"); |
532 | printf("%-" . $max_strlen . "s %8s %10s %8s %8s %8s %8s\n", "Kswapd", "Kswapd", "Order", "Pages", "Pages", "Pages"); | 555 | printf("%-" . $max_strlen . "s %8s %10s %8s %8s %8s %8s\n", "Kswapd", "Kswapd", "Order", "Pages", "Pages", "Pages", "Pages"); |
533 | printf("%-" . $max_strlen . "s %8s %10s %8s %8s %8s %8s\n", "Instance", "Wakeups", "Re-wakeup", "Scanned", "Sync-IO", "ASync-IO"); | 556 | printf("%-" . $max_strlen . "s %8s %10s %8s %8s %8s %8s\n", "Instance", "Wakeups", "Re-wakeup", "Scanned", "Rclmed", "Sync-IO", "ASync-IO"); |
534 | foreach $process_pid (keys %stats) { | 557 | foreach $process_pid (keys %stats) { |
535 | 558 | ||
536 | if (!$stats{$process_pid}->{MM_VMSCAN_KSWAPD_WAKE}) { | 559 | if (!$stats{$process_pid}->{MM_VMSCAN_KSWAPD_WAKE}) { |
@@ -539,16 +562,18 @@ sub dump_stats { | |||
539 | 562 | ||
540 | $total_kswapd_wake += $stats{$process_pid}->{MM_VMSCAN_KSWAPD_WAKE}; | 563 | $total_kswapd_wake += $stats{$process_pid}->{MM_VMSCAN_KSWAPD_WAKE}; |
541 | $total_kswapd_nr_scanned += $stats{$process_pid}->{HIGH_NR_SCANNED}; | 564 | $total_kswapd_nr_scanned += $stats{$process_pid}->{HIGH_NR_SCANNED}; |
565 | $total_kswapd_nr_reclaimed += $stats{$process_pid}->{HIGH_NR_RECLAIMED}; | ||
542 | $total_kswapd_writepage_file_sync += $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_SYNC}; | 566 | $total_kswapd_writepage_file_sync += $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_SYNC}; |
543 | $total_kswapd_writepage_anon_sync += $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_SYNC}; | 567 | $total_kswapd_writepage_anon_sync += $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_SYNC}; |
544 | $total_kswapd_writepage_file_async += $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_ASYNC}; | 568 | $total_kswapd_writepage_file_async += $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_ASYNC}; |
545 | $total_kswapd_writepage_anon_async += $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_ASYNC}; | 569 | $total_kswapd_writepage_anon_async += $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_ASYNC}; |
546 | 570 | ||
547 | printf("%-" . $max_strlen . "s %8d %10d %8u %8i %8u", | 571 | printf("%-" . $max_strlen . "s %8d %10d %8u %8u %8i %8u", |
548 | $process_pid, | 572 | $process_pid, |
549 | $stats{$process_pid}->{MM_VMSCAN_KSWAPD_WAKE}, | 573 | $stats{$process_pid}->{MM_VMSCAN_KSWAPD_WAKE}, |
550 | $stats{$process_pid}->{HIGH_KSWAPD_REWAKEUP}, | 574 | $stats{$process_pid}->{HIGH_KSWAPD_REWAKEUP}, |
551 | $stats{$process_pid}->{HIGH_NR_SCANNED}, | 575 | $stats{$process_pid}->{HIGH_NR_SCANNED}, |
576 | $stats{$process_pid}->{HIGH_NR_RECLAIMED}, | ||
552 | $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_SYNC} + $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_SYNC}, | 577 | $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_SYNC} + $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_SYNC}, |
553 | $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_ASYNC} + $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_ASYNC}); | 578 | $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_ASYNC} + $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_ASYNC}); |
554 | 579 | ||
@@ -579,6 +604,7 @@ sub dump_stats { | |||
579 | print "\nSummary\n"; | 604 | print "\nSummary\n"; |
580 | print "Direct reclaims: $total_direct_reclaim\n"; | 605 | print "Direct reclaims: $total_direct_reclaim\n"; |
581 | print "Direct reclaim pages scanned: $total_direct_nr_scanned\n"; | 606 | print "Direct reclaim pages scanned: $total_direct_nr_scanned\n"; |
607 | print "Direct reclaim pages reclaimed: $total_direct_nr_reclaimed\n"; | ||
582 | print "Direct reclaim write file sync I/O: $total_direct_writepage_file_sync\n"; | 608 | print "Direct reclaim write file sync I/O: $total_direct_writepage_file_sync\n"; |
583 | print "Direct reclaim write anon sync I/O: $total_direct_writepage_anon_sync\n"; | 609 | print "Direct reclaim write anon sync I/O: $total_direct_writepage_anon_sync\n"; |
584 | print "Direct reclaim write file async I/O: $total_direct_writepage_file_async\n"; | 610 | print "Direct reclaim write file async I/O: $total_direct_writepage_file_async\n"; |
@@ -588,6 +614,7 @@ sub dump_stats { | |||
588 | print "\n"; | 614 | print "\n"; |
589 | print "Kswapd wakeups: $total_kswapd_wake\n"; | 615 | print "Kswapd wakeups: $total_kswapd_wake\n"; |
590 | print "Kswapd pages scanned: $total_kswapd_nr_scanned\n"; | 616 | print "Kswapd pages scanned: $total_kswapd_nr_scanned\n"; |
617 | print "Kswapd pages reclaimed: $total_kswapd_nr_reclaimed\n"; | ||
591 | print "Kswapd reclaim write file sync I/O: $total_kswapd_writepage_file_sync\n"; | 618 | print "Kswapd reclaim write file sync I/O: $total_kswapd_writepage_file_sync\n"; |
592 | print "Kswapd reclaim write anon sync I/O: $total_kswapd_writepage_anon_sync\n"; | 619 | print "Kswapd reclaim write anon sync I/O: $total_kswapd_writepage_anon_sync\n"; |
593 | print "Kswapd reclaim write file async I/O: $total_kswapd_writepage_file_async\n"; | 620 | print "Kswapd reclaim write file async I/O: $total_kswapd_writepage_file_async\n"; |
@@ -612,6 +639,7 @@ sub aggregate_perprocesspid() { | |||
612 | $perprocess{$process}->{MM_VMSCAN_WAKEUP_KSWAPD} += $perprocesspid{$process_pid}->{MM_VMSCAN_WAKEUP_KSWAPD}; | 639 | $perprocess{$process}->{MM_VMSCAN_WAKEUP_KSWAPD} += $perprocesspid{$process_pid}->{MM_VMSCAN_WAKEUP_KSWAPD}; |
613 | $perprocess{$process}->{HIGH_KSWAPD_REWAKEUP} += $perprocesspid{$process_pid}->{HIGH_KSWAPD_REWAKEUP}; | 640 | $perprocess{$process}->{HIGH_KSWAPD_REWAKEUP} += $perprocesspid{$process_pid}->{HIGH_KSWAPD_REWAKEUP}; |
614 | $perprocess{$process}->{HIGH_NR_SCANNED} += $perprocesspid{$process_pid}->{HIGH_NR_SCANNED}; | 641 | $perprocess{$process}->{HIGH_NR_SCANNED} += $perprocesspid{$process_pid}->{HIGH_NR_SCANNED}; |
642 | $perprocess{$process}->{HIGH_NR_RECLAIMED} += $perprocesspid{$process_pid}->{HIGH_NR_RECLAIMED}; | ||
615 | $perprocess{$process}->{MM_VMSCAN_WRITEPAGE_FILE_SYNC} += $perprocesspid{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_SYNC}; | 643 | $perprocess{$process}->{MM_VMSCAN_WRITEPAGE_FILE_SYNC} += $perprocesspid{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_SYNC}; |
616 | $perprocess{$process}->{MM_VMSCAN_WRITEPAGE_ANON_SYNC} += $perprocesspid{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_SYNC}; | 644 | $perprocess{$process}->{MM_VMSCAN_WRITEPAGE_ANON_SYNC} += $perprocesspid{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_SYNC}; |
617 | $perprocess{$process}->{MM_VMSCAN_WRITEPAGE_FILE_ASYNC} += $perprocesspid{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_ASYNC}; | 645 | $perprocess{$process}->{MM_VMSCAN_WRITEPAGE_FILE_ASYNC} += $perprocesspid{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_ASYNC}; |