From: Arnaldo Carvalho de Melo <[email protected]> Some events (PERF_RECORD_COMM,EXEC,EXIT,etc) don't set perf_event_attr.misc with the PERF_RECORD_MISC_ bits in PERF_RECORD_MISC_CPUMODE_MASK, and were being discarded, for those we need just to set the machine to be used to be machines.host.
Even with those events not being considered 'top' worked because it would create thread structs by means of machine__findnew_thread() when processing a sample or PERF_RECORD_MMAP event, that sets the field to PERF_RECORD_MISC_USER, and thus we could find the DSO where samples took place, resolve IPs to symbols, etc. But the effect was that the threads would remain in machines->threads forever, slowly using more and more memory and making the thread lookup to take longer than needed, fix it. Cc: Adrian Hunter <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: David Ahern <[email protected]> Cc: Don Zickus <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Stephane Eranian <[email protected]> Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]> --- tools/perf/builtin-top.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 1cb3436276d1..67349fdc51d8 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -832,6 +832,12 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx) ++top->kernel_samples; if (top->hide_kernel_symbols) goto next_event; + /* Fall thru */ + default: + /* + * For events that don't set the cpumode, like: + * PERF_RECORD_{COMM,FORK,EXIT,THROTTLE,UNTHROTTLE} + */ machine = &session->machines.host; break; case PERF_RECORD_MISC_GUEST_KERNEL: @@ -845,8 +851,6 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx) * TODO: we don't process guest user from host side * except simple counting. */ - /* Fall thru */ - default: goto next_event; } -- 1.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

