trace-vmscan-postprocess: fix parsing and output
PATCH 1/2 trace-vmscan-postprocess: sync with tracepoints updates
In reply to Florian Schmidtmm_vmscan_{direct_reclaim_begin,wakeup_kswapd,lru_isolate,lru_shrink_active} changed their output to the point where the script throws warnings and errors. Update it to be properly in line with those changes.
--- .../postprocess/trace-vmscan-postprocess.pl | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-)
Documentation/trace/postprocess/trace-vmscan-postprocess.pl +11 -12
@@ -107,14 +107,14 @@ GetOptions( ); # Defaults for dynamically discovered regex's -my $regex_direct_begin_default = 'order=([0-9]*) may_writepage=([0-9]*) gfp_flags=([A-Z_|]*)'; +my $regex_direct_begin_default = 'order=([0-9]*) gfp_flags=([A-Z_|]*)'; my $regex_direct_end_default = 'nr_reclaimed=([0-9]*)'; my $regex_kswapd_wake_default = 'nid=([0-9]*) order=([0-9]*)'; my $regex_kswapd_sleep_default = 'nid=([0-9]*)'; -my $regex_wakeup_kswapd_default = 'nid=([0-9]*) zid=([0-9]*) order=([0-9]*) gfp_flags=([A-Z_|]*)'; -my $regex_lru_isolate_default = 'isolate_mode=([0-9]*) classzone_idx=([0-9]*) order=([0-9]*) nr_requested=([0-9]*) nr_scanned=([0-9]*) nr_skipped=([0-9]*) nr_taken=([0-9]*) lru=([a-z_]*)'; +my $regex_wakeup_kswapd_default = 'nid=([0-9]*) order=([0-9]*) gfp_flags=([A-Z_|]*)'; +my $regex_lru_isolate_default = 'isolate_mode=([0-9]*) classzone=([0-9]*) order=([0-9]*) nr_requested=([0-9]*) nr_scanned=([0-9]*) nr_skipped=([0-9]*) nr_taken=([0-9]*) lru=([a-z_]*)'; my $regex_lru_shrink_inactive_default = 'nid=([0-9]*) nr_scanned=([0-9]*) nr_reclaimed=([0-9]*) nr_dirty=([0-9]*) nr_writeback=([0-9]*) nr_congested=([0-9]*) nr_immediate=([0-9]*) nr_activate_anon=([0-9]*) nr_activate_file=([0-9]*) nr_ref_keep=([0-9]*) nr_unmap_fail=([0-9]*) priority=([0-9]*) flags=([A-Z_|]*)'; -my $regex_lru_shrink_active_default = 'lru=([A-Z_]*) nr_scanned=([0-9]*) nr_rotated=([0-9]*) priority=([0-9]*)'; +my $regex_lru_shrink_active_default = 'nid=([0-9]*) nr_active=([0-9]*) nr_deactivated=([0-9]*) nr_referenced=([0-9]*) priority=([0-9]*) flags=([A-Z_]*)'; my $regex_writepage_default = 'page=([0-9a-f]*) pfn=([0-9]*) flags=([A-Z_|]*)'; # Dyanically discovered regex
@@ -184,8 +184,7 @@ sub generate_traceevent_regex { $regex_direct_begin = generate_traceevent_regex( "vmscan/mm_vmscan_direct_reclaim_begin", $regex_direct_begin_default, - "order", "may_writepage", - "gfp_flags"); + "order", "gfp_flags"); $regex_direct_end = generate_traceevent_regex( "vmscan/mm_vmscan_direct_reclaim_end", $regex_direct_end_default,
@@ -201,11 +200,11 @@ $regex_kswapd_sleep = generate_traceevent_regex( $regex_wakeup_kswapd = generate_traceevent_regex( "vmscan/mm_vmscan_wakeup_kswapd", $regex_wakeup_kswapd_default, - "nid", "zid", "order", "gfp_flags"); + "nid", "order", "gfp_flags"); $regex_lru_isolate = generate_traceevent_regex( "vmscan/mm_vmscan_lru_isolate", $regex_lru_isolate_default, - "isolate_mode", "classzone_idx", "order", + "isolate_mode", "classzone", "order", "nr_requested", "nr_scanned", "nr_skipped", "nr_taken", "lru"); $regex_lru_shrink_inactive = generate_traceevent_regex(
@@ -218,9 +217,9 @@ $regex_lru_shrink_inactive = generate_traceevent_regex( $regex_lru_shrink_active = generate_traceevent_regex( "vmscan/mm_vmscan_lru_shrink_active", $regex_lru_shrink_active_default, - "nid", "zid", - "lru", - "nr_scanned", "nr_rotated", "priority"); + "nid", + "nr_taken", "nr_active", "nr_deactivated", "nr_referenced", + "priority", "flags"); $regex_writepage = generate_traceevent_regex( "vmscan/mm_vmscan_writepage", $regex_writepage_default,
@@ -371,7 +370,7 @@ EVENT_PROCESS: print " $regex_wakeup_kswapd\n"; next; } - my $order = $3; + my $order = $2; $perprocesspid{$process_pid}->{MM_VMSCAN_WAKEUP_KSWAPD_PERORDER}[$order]++; } elsif ($tracepoint eq "mm_vmscan_lru_isolate") { $details = $6;
Signature · 1 line
2.23.0.rc1
cover trace-vmscan-postprocess: fix parsing and output
This patch series updates trace-vmscan-postprocess.pl to work without throwing warnings and errors which stem from updates to several trace points.
3481c37ffa1d ("mm/vmscan: drop may_writepage and classzone_idx from direct reclaim begin template") removed "may_writepage" from mm_vmscan_direct_reclaim_begin, and 3b775998eca7 ("include/trace/events/vmscan.h: drop zone id from kswapd tracepoints") removed "zid" from mm_vmscan_wakeup_kswapd. The output of mm_vmscan_lru_isolate and mm_vmscan_lru_shrink_active seems to never have matched the format of the trace point output since they were created, or at least for as long as I can tell. Patch 1 aligns the format parsing of the perl script with the current output of the trace points.
In addition, the tables that are printed by the script were not properly aligned any more, so patch 2 fixes the spacing.
A side remark: parsing the trace output for mm_vmscan_lru_shrink_active has been in the script ever since it was created in 2010, but at no point the parsed output was ever used for anything. I updated the parsing code now, but I wonder if we could just get rid of that part...
Florian Schmidt (2):
trace-vmscan-postprocess: sync with tracepoints updates
trace-vmscan-postprocess: fix output table spacing
.../postprocess/trace-vmscan-postprocess.pl | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-)
Signature · 1 line
2.23.0.rc1
PATCH 2/2 trace-vmscan-postprocess: fix output table spacing
Fix spacing so that both the headers in themselves, as well as the output of the two tables related to each other, are properly aligned.
--- Documentation/trace/postprocess/trace-vmscan-postprocess.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Documentation/trace/postprocess/trace-vmscan-postprocess.pl +3 -3
@@ -575,8 +575,8 @@ sub dump_stats { # Print out kswapd activity printf("\n"); - printf("%-" . $max_strlen . "s %8s %10s %8s %8s %8s %8s\n", "Kswapd", "Kswapd", "Order", "Pages", "Pages", "Pages", "Pages"); - printf("%-" . $max_strlen . "s %8s %10s %8s %8s %8s %8s\n", "Instance", "Wakeups", "Re-wakeup", "Scanned", "Rclmed", "Sync-IO", "ASync-IO"); + printf("%-" . $max_strlen . "s %8s %10s %8s %8s %8s %8s\n", "Kswapd", "Kswapd", "Order", "Pages", "Pages", "Pages", "Pages"); + printf("%-" . $max_strlen . "s %8s %10s %8s %8s %8s %8s\n", "Instance", "Wakeups", "Re-wakeup", "Scanned", "Rclmed", "Sync-IO", "ASync-IO"); foreach $process_pid (keys %stats) { if (!$stats{$process_pid}->{MM_VMSCAN_KSWAPD_WAKE}) {
@@ -595,7 +595,7 @@ sub dump_stats { $total_kswapd_writepage_file_async += $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_ASYNC}; $total_kswapd_writepage_anon_async += $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_ASYNC}; - printf("%-" . $max_strlen . "s %8d %10d %8u %8u %8i %8u", + printf("%-" . $max_strlen . "s %8d %10d %8u %8u %8i %8u ", $process_pid, $stats{$process_pid}->{MM_VMSCAN_KSWAPD_WAKE}, $stats{$process_pid}->{HIGH_KSWAPD_REWAKEUP},
Signature · 1 line
2.23.0.rc1