From: Jiri Olsa <jolsa@redhat.com>
To: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Cc: acme@kernel.org, namhyung@kernel.org, irogers@google.com,
songliubraving@fb.com, yao.jin@linux.intel.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] perf annotate: Nuke privsize
Date: Mon, 20 Jan 2020 11:08:25 +0100 [thread overview]
Message-ID: <20200120100825.GG608405@krava> (raw)
In-Reply-To: <20200117092612.30874-2-ravi.bangoria@linux.ibm.com>
On Fri, Jan 17, 2020 at 02:56:10PM +0530, Ravi Bangoria wrote:
> We don't use privsize now and it's always 0. Remove privsize
> from code. Also simplify disasm_line allocation and freeing
> code which was bit complex because of privsize.
>
> Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
> ---
> tools/perf/builtin-top.c | 2 +-
> tools/perf/ui/gtk/annotate.c | 2 +-
> tools/perf/util/annotate.c | 92 +++++++++++++-----------------------
> tools/perf/util/annotate.h | 3 +-
> 4 files changed, 35 insertions(+), 64 deletions(-)
>
> diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
> index 795e353de095..26765e41c083 100644
> --- a/tools/perf/builtin-top.c
> +++ b/tools/perf/builtin-top.c
> @@ -143,7 +143,7 @@ static int perf_top__parse_source(struct perf_top *top, struct hist_entry *he)
> return err;
> }
>
> - err = symbol__annotate(&he->ms, evsel, 0, &top->annotation_opts, NULL);
> + err = symbol__annotate(&he->ms, evsel, &top->annotation_opts, NULL);
> if (err == 0) {
> top->sym_filter_entry = he;
> } else {
> diff --git a/tools/perf/ui/gtk/annotate.c b/tools/perf/ui/gtk/annotate.c
> index 22cc240f7371..35f9641bf670 100644
> --- a/tools/perf/ui/gtk/annotate.c
> +++ b/tools/perf/ui/gtk/annotate.c
> @@ -174,7 +174,7 @@ static int symbol__gtk_annotate(struct map_symbol *ms, struct evsel *evsel,
> if (ms->map->dso->annotate_warned)
> return -1;
>
> - err = symbol__annotate(ms, evsel, 0, &annotation__default_options, NULL);
> + err = symbol__annotate(ms, evsel, &annotation__default_options, NULL);
> if (err) {
> char msg[BUFSIZ];
> symbol__strerror_disassemble(ms, err, msg, sizeof(msg));
> diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
> index f5e77ed237e8..7f9851772462 100644
> --- a/tools/perf/util/annotate.c
> +++ b/tools/perf/util/annotate.c
> @@ -1143,7 +1143,6 @@ static int disasm_line__parse(char *line, const char **namep, char **rawp)
> }
>
> struct annotate_args {
> - size_t privsize;
> struct arch *arch;
> struct map_symbol ms;
> struct evsel *evsel;
> @@ -1153,83 +1152,55 @@ struct annotate_args {
> int line_nr;
> };
>
> -static void annotation_line__delete(struct annotation_line *al)
> +static void annotation_line__new(struct annotation_line *al,
> + struct annotate_args *args,
> + int nr)
> {
> - void *ptr = (void *) al - al->privsize;
> -
> - free_srcline(al->path);
> - zfree(&al->line);
> - free(ptr);
> + al->offset = args->offset;
> + al->line = strdup(args->line);
> + al->line_nr = args->line_nr;
> + al->data_nr = nr;
> }
>
> -/*
> - * Allocating the annotation line data with following
> - * structure:
> - *
> - * --------------------------------------
> - * private space | struct annotation_line
> - * --------------------------------------
> - *
> - * Size of the private space is stored in 'struct annotation_line'.
> - *
> - */
> -static struct annotation_line *
> -annotation_line__new(struct annotate_args *args, size_t privsize)
> +static size_t disasm_line_size(int nr)
> {
I agree we can get rid of the 'users' privsize passed from symbol__annotate,
but could you please put it in separate patch, while keeping privsize in here?
and then put the rest of the code factoring into separate patch,
so we can see clearly the change and the benefits
your new annotation_line__new should be renamed to something like
annotation_line__init ... we keep __new suffix for functions that
return new objects
thanks,
jirka
next prev parent reply other threads:[~2020-01-20 10:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-17 9:26 [PATCH 0/3] perf annotate: Misc fixes / improvements Ravi Bangoria
2020-01-17 9:26 ` [PATCH 1/3] perf annotate: Nuke privsize Ravi Bangoria
2020-01-20 10:08 ` Jiri Olsa [this message]
2020-01-20 12:49 ` Ravi Bangoria
2020-01-17 9:26 ` [PATCH 2/3] perf annotate: Align struct annotate_args Ravi Bangoria
2020-01-17 9:26 ` [PATCH 3/3] perf annotate: Fix segfault with source toggle Ravi Bangoria
2020-01-20 10:12 ` Jiri Olsa
2020-01-20 12:50 ` Ravi Bangoria
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=20200120100825.GG608405@krava \
--to=jolsa@redhat.com \
--cc=acme@kernel.org \
--cc=irogers@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=namhyung@kernel.org \
--cc=ravi.bangoria@linux.ibm.com \
--cc=songliubraving@fb.com \
--cc=yao.jin@linux.intel.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