From: tip-bot for Arnaldo Carvalho de Melo <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, ak@linux.intel.com,
mingo@kernel.org, dsahern@gmail.com, wangnan0@huawei.com,
hpa@zytor.com, peterz@infradead.org, acme@redhat.com,
lukasz.odzioba@intel.com, kan.liang@intel.com,
adrian.hunter@intel.com, namhyung@kernel.org, jolsa@kernel.org,
tglx@linutronix.de
Subject: [tip:perf/core] perf machine: Optimize a bit the machine__findnew_thread() methods
Date: Fri, 22 Sep 2017 09:42:54 -0700 [thread overview]
Message-ID: <tip-800zehjsyy03er4s4jf0e99v@git.kernel.org> (raw)
Commit-ID: 75e45e432052c7b1a5da866cff88192db8be1445
Gitweb: http://git.kernel.org/tip/75e45e432052c7b1a5da866cff88192db8be1445
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Thu, 14 Sep 2017 16:16:34 -0300
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 18 Sep 2017 09:40:19 -0300
perf machine: Optimize a bit the machine__findnew_thread() methods
In some cases we already have calculated the hash bucket, so reuse it.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Lukasz Odzioba <lukasz.odzioba@intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-800zehjsyy03er4s4jf0e99v@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/machine.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index f4f9267..ddeea05 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -399,10 +399,10 @@ out_err:
* lookup/new thread inserted.
*/
static struct thread *____machine__findnew_thread(struct machine *machine,
+ struct threads *threads,
pid_t pid, pid_t tid,
bool create)
{
- struct threads *threads = machine__threads(machine, tid);
struct rb_node **p = &threads->entries.rb_node;
struct rb_node *parent = NULL;
struct thread *th;
@@ -473,7 +473,7 @@ static struct thread *____machine__findnew_thread(struct machine *machine,
struct thread *__machine__findnew_thread(struct machine *machine, pid_t pid, pid_t tid)
{
- return ____machine__findnew_thread(machine, pid, tid, true);
+ return ____machine__findnew_thread(machine, machine__threads(machine, tid), pid, tid, true);
}
struct thread *machine__findnew_thread(struct machine *machine, pid_t pid,
@@ -495,7 +495,7 @@ struct thread *machine__find_thread(struct machine *machine, pid_t pid,
struct thread *th;
pthread_rwlock_rdlock(&threads->lock);
- th = ____machine__findnew_thread(machine, pid, tid, false);
+ th = ____machine__findnew_thread(machine, threads, pid, tid, false);
pthread_rwlock_unlock(&threads->lock);
return th;
}
reply other threads:[~2017-09-22 16:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=tip-800zehjsyy03er4s4jf0e99v@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=ak@linux.intel.com \
--cc=dsahern@gmail.com \
--cc=hpa@zytor.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=lukasz.odzioba@intel.com \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=wangnan0@huawei.com \
/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