From: Jiri Olsa <jolsa@redhat.com>
To: Ian Rogers <irogers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Namhyung Kim <namhyung@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
linux-kernel@vger.kernel.org,
Stephane Eranian <eranian@google.com>
Subject: Re: [PATCH 2/2] lib kallsyms: parse using io api
Date: Fri, 1 May 2020 14:23:45 +0200 [thread overview]
Message-ID: <20200501122345.GA1810115@krava> (raw)
In-Reply-To: <20200430193557.101831-3-irogers@google.com>
On Thu, Apr 30, 2020 at 12:35:57PM -0700, Ian Rogers wrote:
> Perf record will call kallsyms__parse 4 times during startup and process
> megabytes of data. This changes kallsyms__parse to use the io library
> rather than fgets to improve performance of the user code by over 8%.
>
> Before:
> Running 'internals/kallsyms-parse' benchmark:
> Average kallsyms__parse took: 103.988 ms (+- 0.203 ms)
> After:
> Running 'internals/kallsyms-parse' benchmark:
> Average kallsyms__parse took: 95.571 ms (+- 0.006 ms)
>
> For a workload like:
> $ perf record /bin/true
> Run under 'perf record -e cycles:u -g' the time goes from:
> Before
> 30.10% 1.67% perf perf [.] kallsyms__parse
> After
> 25.55% 20.04% perf perf [.] kallsyms__parse
> So a little under 5% of the start-up time is removed. A lot of what
> remains is on the kernel side, but caching kallsyms within perf would
> at least impact memory footprint.
with your change I'm getting following warnings:
$ sudo ./perf record -a
Couldn't record kernel reference relocation symbol
Symbol resolution may be skewed if relocation was used (e.g. kexec).
Check /proc/kallsyms permission or run as root.
>
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
> tools/lib/api/io.h | 3 ++
> tools/lib/symbol/kallsyms.c | 81 +++++++++++++++++++------------------
> 2 files changed, 44 insertions(+), 40 deletions(-)
>
> diff --git a/tools/lib/api/io.h b/tools/lib/api/io.h
> index b7e55b5f8a4a..777c20f6b604 100644
> --- a/tools/lib/api/io.h
> +++ b/tools/lib/api/io.h
> @@ -7,6 +7,9 @@
> #ifndef __API_IO__
> #define __API_IO__
>
> +#include <stdlib.h>
> +#include <unistd.h>
was this missing?
jirka
> +
> struct io {
> /* File descriptor being read/ */
> int fd;
SNIP
next prev parent reply other threads:[~2020-05-01 12:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-30 19:35 [PATCH 0/2] Improvements for kallsyms__parse Ian Rogers
2020-04-30 19:35 ` [PATCH] perf bench: add kallsyms parsing Ian Rogers
2020-04-30 19:35 ` [PATCH 2/2] lib kallsyms: parse using io api Ian Rogers
2020-05-01 12:23 ` Jiri Olsa [this message]
2020-05-01 15:28 ` Ian Rogers
2020-05-01 22:15 ` Ian Rogers
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=20200501122345.GA1810115@krava \
--to=jolsa@redhat.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=eranian@google.com \
--cc=irogers@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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