public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Borislav Petkov <bp@suse.de>, David Ahern <dsahern@gmail.com>,
	Don Zickus <dzickus@redhat.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	Stephane Eranian <eranian@google.com>
Subject: [PATCH 01/16] perf top: Consider PERF_RECORD_ events with cpumode == 0
Date: Tue,  7 Apr 2015 13:40:47 -0300	[thread overview]
Message-ID: <1428424862-30032-2-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1428424862-30032-1-git-send-email-acme@kernel.org>

From: Arnaldo Carvalho de Melo <acme@redhat.com>

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 <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-pzzsmdr4ljsso771ul83ij1f@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 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


  reply	other threads:[~2015-04-07 16:41 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-07 16:40 [GIT PULL 00/16] perf/core improvements and fixes Arnaldo Carvalho de Melo
2015-04-07 16:40 ` Arnaldo Carvalho de Melo [this message]
2015-04-07 16:40 ` [PATCH 02/16] perf evlist: Fix inverted logic in perf_mmap__empty Arnaldo Carvalho de Melo
2015-04-07 16:40 ` [PATCH 03/16] perf kmaps: Check kmaps to make code more robust Arnaldo Carvalho de Melo
2015-04-07 16:40 ` [PATCH 04/16] tools lib traceevent: Honor operator priority Arnaldo Carvalho de Melo
2015-04-07 16:40 ` [PATCH 05/16] perf kmem: Respect -i option Arnaldo Carvalho de Melo
2015-04-07 16:40 ` [PATCH 06/16] perf sched replay: Use struct task_desc instead of struct task_task for correct meaning Arnaldo Carvalho de Melo
2015-04-07 16:40 ` [PATCH 07/16] perf sched replay: Increase the MAX_PID value to fix assertion failure problem Arnaldo Carvalho de Melo
2015-04-07 16:40 ` [PATCH 08/16] perf sched replay: Alloc the memory of pid_to_task dynamically to adapt to the unexpected change of pid_max Arnaldo Carvalho de Melo
2015-04-07 16:40 ` [PATCH 09/16] perf sched replay: Realloc the memory of pid_to_task stepwise to adapt to the different pid_max configurations Arnaldo Carvalho de Melo
2015-04-07 16:40 ` [PATCH 10/16] perf sched replay: Fix the segmentation fault problem caused by pr_err in threads Arnaldo Carvalho de Melo
2015-04-07 16:40 ` [PATCH 11/16] perf sched replay: Handle the dead halt of sem_wait when create_tasks() fails for any task Arnaldo Carvalho de Melo
2015-04-07 16:40 ` [PATCH 12/16] perf sched replay: Fix the EMFILE error caused by the limitation of the maximum open files Arnaldo Carvalho de Melo
2015-04-07 16:40 ` [PATCH 13/16] perf sched replay: Support using -f to override perf.data file ownership Arnaldo Carvalho de Melo
2015-04-07 16:41 ` [PATCH 14/16] perf sched replay: Use replay_repeat to calculate the runavg of cpu usage instead of the default value 10 Arnaldo Carvalho de Melo
2015-04-07 16:41 ` [PATCH 15/16] perf record: Add clockid parameter Arnaldo Carvalho de Melo
2015-04-07 19:06   ` David Ahern
2015-04-07 20:20     ` Arnaldo Carvalho de Melo
2015-04-07 16:41 ` [PATCH 16/16] perf tools: Merge all perf_event_attr print functions Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1428424862-30032-2-git-send-email-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=bp@suse.de \
    --cc=dsahern@gmail.com \
    --cc=dzickus@redhat.com \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox