From: Masami Hiramatsu (Google) <mhira...@kernel.org> If the last boot data is already cleared, there is no reason to update it again. Skip if the TRACE_ARRAY_FL_LAST_BOOT is cleared.
Signed-off-by: Masami Hiramatsu (Google) <mhira...@kernel.org> --- kernel/trace/trace.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 443f2bc5b856..0f010a34de84 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -6041,6 +6041,12 @@ static void update_last_data(struct trace_array *tr) if (!(tr->flags & TRACE_ARRAY_FL_BOOT)) return; + if (!(tr->flags & TRACE_ARRAY_FL_LAST_BOOT)) + return; + + /* Only if the buffer has previous boot data clear and update it. */ + tr->flags &= ~TRACE_ARRAY_FL_LAST_BOOT; + /* Reset the module list and reload them */ if (tr->scratch) { struct trace_scratch *tscratch = tr->scratch; @@ -6052,9 +6058,6 @@ static void update_last_data(struct trace_array *tr) module_for_each_mod(save_mod, tr); } - if (!(tr->flags & TRACE_ARRAY_FL_LAST_BOOT)) - return; - /* * Need to clear all CPU buffers as there cannot be events * from the previous boot mixed with events with this boot @@ -6077,7 +6080,6 @@ static void update_last_data(struct trace_array *tr) #else tscratch->kaslr_addr = 0; #endif - tr->flags &= ~TRACE_ARRAY_FL_LAST_BOOT; } /**