[PATCH 2/3] tracing/hwlat: Don't ignore outer-loop duration when calculating max_latency
From: Srivatsa S. Bhat
Date: Thu Oct 10 2019 - 15:13:15 EST
From: Srivatsa S. Bhat (VMware) <srivatsa@xxxxxxxxxxxxx>
max_latency is intended to record the maximum ever observed hardware
latency, which may occur in either part of the loop (inner/outer). So
we need to also consider the outer-loop sample when updating
max_latency.
Fixes: e7c15cd8a113 ("tracing: Added hardware latency tracer")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Srivatsa S. Bhat (VMware) <srivatsa@xxxxxxxxxxxxx>
---
kernel/trace/trace_hwlat.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/trace/trace_hwlat.c b/kernel/trace/trace_hwlat.c
index a0251a7..862f4b0 100644
--- a/kernel/trace/trace_hwlat.c
+++ b/kernel/trace/trace_hwlat.c
@@ -256,6 +256,8 @@ static int get_sample(void)
/* Keep a running maximum ever recorded hardware latency */
if (sample > tr->max_latency)
tr->max_latency = sample;
+ if (outer_sample > tr->max_latency)
+ tr->max_latency = outer_sample;
}
out: