From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arnaldo Carvalho de Melo Subject: Re: [PATCH 3/3 v2] perf symbols: convert symbol__is_idle to use strlist Date: Mon, 10 Feb 2020 16:32:51 -0300 Message-ID: <20200210193251.GD3416@kernel.org> References: <20200207230613.26709-1-kim.phillips@amd.com> <20200210163147.25358-1-kim.phillips@amd.com> <4F6B8692-B1FE-4108-A6B3-44EEE5F92C97@fb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <4F6B8692-B1FE-4108-A6B3-44EEE5F92C97@fb.com> Sender: linux-kernel-owner@vger.kernel.org To: Song Liu Cc: Kim Phillips , Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Andi Kleen , Mark Rutland , Alexander Shishkin , Jiri Olsa , Jiri Olsa , Namhyung Kim , Cong Wang , Jin Yao , Kan Liang , Davidlohr Bueso , "linux-perf-users@vger.kernel.org" , "linux-kernel@vger.kernel.org" List-Id: linux-perf-users.vger.kernel.org Em Mon, Feb 10, 2020 at 06:51:53PM +0000, Song Liu escreveu: > > > > On Feb 10, 2020, at 8:31 AM, Kim Phillips wrote: > > > > Use the more optimized strlist implementation to do the idle function > > lookup. > > > > Cc: Peter Zijlstra > > Cc: Ingo Molnar > > Cc: Andi Kleen > > Cc: Arnaldo Carvalho de Melo > > Cc: Mark Rutland > > Cc: Alexander Shishkin > > Cc: Jiri Olsa > > Cc: Jiri Olsa > > Cc: Namhyung Kim > > Cc: Cong Wang > > Cc: Jin Yao > > Cc: Kan Liang > > Cc: Kim Phillips > > Cc: Song Liu > > Cc: Davidlohr Bueso > > Cc: linux-perf-users@vger.kernel.org > > Cc: linux-kernel@vger.kernel.org > > Signed-off-by: Kim Phillips > > --- > > v2: new this series, based on Jiri's comment: > > > > https://lore.kernel.org/lkml/20200120092844.GC608405@krava/ > > > > ...and this time with the Cc list intact. > > > > tools/perf/util/symbol.c | 14 +++++++++----- > > 1 file changed, 9 insertions(+), 5 deletions(-) > > > > diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c > > index f3120c4f47ad..1077013d8ce2 100644 > > --- a/tools/perf/util/symbol.c > > +++ b/tools/perf/util/symbol.c > > @@ -654,13 +654,17 @@ static bool symbol__is_idle(const char *name) > > NULL > > }; > > int i; > > + static struct strlist *idle_symbols_list; > > nit, probably just personal preference: > > Maybe move idle_symbols_list out of the function and add the logic > to symbol__init()? > > Other than this: > > Acked-by: Song Liu I applied it as is, improvements can be made on top of it. - Arnaldo > > > > - for (i = 0; idle_symbols[i]; i++) { > > - if (!strcmp(idle_symbols[i], name)) > > - return true; > > - } > > + if (idle_symbols_list) > > + return strlist__has_entry(idle_symbols_list, name); > > > > - return false; > > + idle_symbols_list = strlist__new(NULL, NULL); > > + > > + for (i = 0; idle_symbols[i]; i++) > > + strlist__add(idle_symbols_list, idle_symbols[i]); > > + > > + return strlist__has_entry(idle_symbols_list, name); > > } > > > > static int map__process_kallsym_symbol(void *arg, const char *name, > > -- > > 2.25.0 > > > -- - Arnaldo