x86/events/intel/ds: Enable large PEBS for PERF_SAMPLE_WEIGHT_TYPE
authorLike Xu <likexu@tencent.com>
Thu, 19 May 2022 15:19:13 +0000 (23:19 +0800)
committerPeter Zijlstra <peterz@infradead.org>
Mon, 13 Jun 2022 08:15:13 +0000 (10:15 +0200)
All the information required by the PERF_SAMPLE_WEIGHT is
available in the pebs record. Thus large PEBS could be enabled
for PERF_SAMPLE_WEIGHT sample type to save PMIs overhead until
other non-compatible flags such as PERF_SAMPLE_DATA_PAGE_SIZE
(due to lack of munmap tracking) stop it.

To cover new weight extension, add PERF_SAMPLE_WEIGHT_TYPE
to the guardian LARGE_PEBS_FLAGS.

Tested it with:

$ perf mem record -c 1000 workload
Before: Captured and wrote 0.126 MB perf.data (958 samples) [958 PMIs]
After: Captured and wrote 0.313 MB perf.data (4859 samples) [3 PMIs]

Reported-by: Yongchao Duan <yongduan@tencent.com>
Signed-off-by: Like Xu <likexu@tencent.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20220519151913.80545-1-likexu@tencent.com
arch/x86/events/perf_event.h

index 21a5482bcf8458c29a62fb6670a4eadaa4aaa683..1ca6200ca135194e5a1085c0749fb43492eb3778 100644 (file)
@@ -136,7 +136,8 @@ struct amd_nb {
        PERF_SAMPLE_DATA_SRC | PERF_SAMPLE_IDENTIFIER | \
        PERF_SAMPLE_TRANSACTION | PERF_SAMPLE_PHYS_ADDR | \
        PERF_SAMPLE_REGS_INTR | PERF_SAMPLE_REGS_USER | \
-       PERF_SAMPLE_PERIOD | PERF_SAMPLE_CODE_PAGE_SIZE)
+       PERF_SAMPLE_PERIOD | PERF_SAMPLE_CODE_PAGE_SIZE | \
+       PERF_SAMPLE_WEIGHT_TYPE)
 
 #define PEBS_GP_REGS                   \
        ((1ULL << PERF_REG_X86_AX)    | \