Messages in this thread | | | Date | Tue, 16 Aug 2022 12:41:28 -0400 | From | Steven Rostedt <> | Subject | Re: [RFC PATCH 1/9] cxl/mem: Implement Get Event Records command |
| |
On Tue, 16 Aug 2022 12:39:58 -0400 Steven Rostedt <rostedt@goodmis.org> wrote:
> > + record_count = le16_to_cpu(payload.record_count); > > + if (record_count > 0) > > + trace_cxl_event(dev_name(cxlds->dev), type, > > + &payload.record); > > + > > + if (payload.flags & CXL_GET_EVENT_FLAG_OVERFLOW) > > + trace_cxl_event_overflow(dev_name(cxlds->dev), type, > > + &payload); > > If you want to avoid the compare operations when the tracepoints are not > enabled, you can add: > > if (trace_cxl_event_enabled()) { > if (record_count > 0) > trace_cxl_event(dev_name(cxlds->dev), type, > &payload.record); > } > > if (trace_cxl_event_overflow_enabled()) { > if (payload.flags & CXL_GET_EVENT_FLAG_OVERFLOW) > trace_cxl_event_overflow(dev_name(cxlds->dev), type, > &payload); > } > > Those "<tracepoint>_enabled()" functions are static branches. Which means > when not enabled it's a nop that skips this code, and when either is > enabled, it turns into a jump to the contents of the if block.
Ignore this suggestion. I see in the second patch you add more logic to the if condition. Only use this suggestion if the logic is only for when the tracepoint is enabled.
-- Steve
| |