Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1217574

Re: [PATCH] perf tools: Don't write to evsel if parser doesn't collect evsel

From Jiri Olsa <jolsa@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH] perf tools: Don't write to evsel if parser doesn't collect evsel
Date 2015-09-02 14:50 +0200
Message-ID <q4fEd-5kp-1@gated-at.bofh.it> (permalink)
References <q49fr-4zG-7@gated-at.bofh.it> <q4abx-5U4-19@gated-at.bofh.it> <q4abx-5U4-17@gated-at.bofh.it> <q4eRQ-4a6-13@gated-at.bofh.it> <q4f1w-4AK-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Sep 02, 2015 at 08:05:54PM +0800, pi3orama wrote:

SNIP

> >>>        perf_evlist__splice_list_tail(evlist, &data.list, entries);
> >>>        evlist->nr_groups += data.nr_groups;
> >>> -        last = perf_evlist__last(evlist);
> >>> -        last->cmdline_group_boundary = true;
> >>>        return 0;
> >>>    }
> >>> @@ -1252,7 +1262,13 @@ foreach_evsel_in_last_glob(struct perf_evlist *evlist,
> >>>    struct perf_evsel *last = NULL;
> >>>    int err;
> >>> -    if (evlist->nr_entries > 0)
> >>> +    /*
> >>> +     * Don't return when list_empty, give func a chance to report
> >>> +     * error when it found last == NULL.
> >>> +     *
> >>> +     * So no need to WARN here, let *func do this.
> >>> +     */
> >>> +    if (!list_empty(&evlist->entries))
> > 
> > why is it better than to check evlist->nr_entries?
> > evlist->nr_entries is equivalent to !list_empty(&evlist->entries) in here, right?
> > 
> 
> By checking list we won't rely on the assumption that nr_entries reflects the
> actual number of elements in that list, makes the logic of this code more compact.
> Don't you think so?
> 
> At this point they are equivalent, but the whole patch is preventive action.

ok, fair enough ;-)

Acked-by: Jiri Olsa <jolsa@kernel.org>

thanks,
jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 02/31] perf tools: Don't set cmdline_group_boundary if no evsel is collected Wang Nan <wangnan0@huawei.com> - 2015-08-29 06:30 +0200
  Re: [PATCH 02/31] perf tools: Don't set cmdline_group_boundary if no  evsel is collected Arnaldo Carvalho de Melo <acme@redhat.com> - 2015-08-31 21:30 +0200
    Re: [PATCH 02/31] perf tools: Don't set cmdline_group_boundary if no  evsel is collected Jiri Olsa <jolsa@redhat.com> - 2015-09-01 12:40 +0200
      Re: [PATCH 02/31] perf tools: Don't set cmdline_group_boundary if  no evsel is collected "Wangnan (F)" <wangnan0@huawei.com> - 2015-09-01 14:50 +0200
    Re: [PATCH 02/31] perf tools: Don't set cmdline_group_boundary if  no evsel is collected "Wangnan (F)" <wangnan0@huawei.com> - 2015-09-01 13:00 +0200
  [PATCH] perf tools: Don't set leader if parser doesn't collect an evsel Wang Nan <wangnan0@huawei.com> - 2015-09-02 05:00 +0200
    Re: [PATCH] perf tools: Don't set leader if parser doesn't collect  an evsel "Wangnan (F)" <wangnan0@huawei.com> - 2015-09-02 05:10 +0200
    RE: [PATCH] perf tools: Don't set leader if parser doesn't collect  an evsel 平松雅巳 / HIRAMATU,MASAMI   <masami.hiramatsu.pt@hitachi.com> - 2015-09-02 08:00 +0200
      Re: [PATCH] perf tools: Don't set leader if parser doesn't collect  an evsel "Wangnan (F)" <wangnan0@huawei.com> - 2015-09-02 08:10 +0200
      Re: [PATCH] perf tools: Don't write to evsel if parser doesn't collect  evsel "Wangnan (F)" <wangnan0@huawei.com> - 2015-09-02 09:00 +0200
        RE: [PATCH] perf tools: Don't write to evsel if parser doesn't  collect evsel 平松雅巳 / HIRAMATU,MASAMI   <masami.hiramatsu.pt@hitachi.com> - 2015-09-02 12:40 +0200
        Re: [PATCH] perf tools: Don't write to evsel if parser doesn't  collect evsel Jiri Olsa <jolsa@redhat.com> - 2015-09-02 14:00 +0200
          Re: [PATCH] perf tools: Don't write to evsel if parser doesn't collect evsel pi3orama <pi3orama@163.com> - 2015-09-02 14:10 +0200
            Re: [PATCH] perf tools: Don't write to evsel if parser doesn't  collect evsel Jiri Olsa <jolsa@redhat.com> - 2015-09-02 14:50 +0200
            Re: [PATCH] perf tools: Don't write to evsel if parser doesn't  collect evsel Arnaldo Carvalho de Melo <acme@redhat.com> - 2015-09-02 16:00 +0200
              Re: [PATCH] perf tools: Don't write to evsel if parser doesn't collect evsel pi3orama <pi3orama@163.com> - 2015-09-02 16:10 +0200
                Re: [PATCH] perf tools: Don't write to evsel if parser doesn't  collect evsel Arnaldo Carvalho de Melo <acme@redhat.com> - 2015-09-02 16:50 +0200
                Re: [PATCH] perf tools: Don't write to evsel if parser doesn't collect evsel pi3orama <pi3orama@163.com> - 2015-09-03 00:30 +0200

csiph-web