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


Groups > linux.kernel > #1655136

Re: [PATCH 2/2] perf tools: Remove extra list_del_init calls in list reset

From Jiri Olsa <jolsa@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] perf tools: Remove extra list_del_init calls in list reset
Date 2017-06-01 15:20 +0200
Message-ID <tNyb8-32h-35@gated-at.bofh.it> (permalink)
References <tNwj0-1RP-11@gated-at.bofh.it> <tNwj0-1RP-21@gated-at.bofh.it> <tNy1r-2YH-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Jun 01, 2017 at 10:02:26AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Thu, Jun 01, 2017 at 01:17:44PM +0200, Jiri Olsa escreveu:
> > We only needs to remove the format from the currently
> > iterated list. The other removals/inits are superfluous
> > because we free the format in any case.
> > 
> > Link: http://lkml.kernel.org/n/tip-8umo89ntt3kawmfwsivav43t@git.kernel.org
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> >  tools/perf/ui/hist.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
> > index feb2174ddd1f..a0fee2ac8599 100644
> > --- a/tools/perf/ui/hist.c
> > +++ b/tools/perf/ui/hist.c
> > @@ -614,15 +614,15 @@ void perf_hpp__reset_output_field(struct perf_hpp_list *list)
> >  
> >  	/* reset output fields */
> >  	perf_hpp_list__for_each_format_safe(list, fmt, tmp) {
> > -		list_del_init(&fmt->list);
> > -		list_del_init(&fmt->sort_list);
> > +		list_del(&fmt->list);
> > +		/* Remove the fmt from next loop processing. */
> > +		list_del(&fmt->sort_list);
> 
> Why not just add the comment and leave it as list_del_init(), then, in
> fmt_free() -> fmt->free() -> hse_free() (for instance), have:
> 
> 	BUG_ON(!list_empty(&fmt->list));
> 	BUG_ON(!list_empty(&fmt->sort_list));
> 
> The patch would be smaller and overall the code would be more robust?

ok, that could catch something.. will change

thanks,
jirka

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


Thread

[PATCH 1/2] perf tools: Fix crash in perf_hpp__reset_output_field Jiri Olsa <jolsa@kernel.org> - 2017-06-01 13:20 +0200
  [PATCH 2/2] perf tools: Remove extra list_del_init calls in list reset Jiri Olsa <jolsa@kernel.org> - 2017-06-01 13:20 +0200
    Re: [PATCH 2/2] perf tools: Remove extra list_del_init calls in list  reset Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-06-01 15:10 +0200
      Re: [PATCH 2/2] perf tools: Remove extra list_del_init calls in list  reset Jiri Olsa <jolsa@redhat.com> - 2017-06-01 15:20 +0200

csiph-web