x86/pmu: Introduce __start_event() to drop all of the manual zeroing
Most invocation of start_event() and measure() first sets evt.count=0. Instead of forcing each caller to ensure count is zeroed, optimize the count to zero during start_event(), then drop all of the manual zeroing. Accumulating counts can be handled by reading the current count before start_event(), and doing something like stuffing a high count to test an edge case could be handled by an inner helper, __start_event(). For overflow, just open code measure() for that one-off case. Requiring callers to zero out a field in most common cases isn't exactly flexible. Suggested-by:Sean Christopherson <seanjc@google.com> Signed-off-by:
Like Xu <likexu@tencent.com> [sean: tag __measure() noinline so its count is stable] Signed-off-by:
Sean Christopherson <seanjc@google.com> Link: https://lore.kernel.org/r/20221102225110.3023543-7-seanjc@google.com
Loading
Please register or sign in to comment