From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 935D0C433F5 for ; Mon, 14 Feb 2022 20:57:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230038AbiBNU5R (ORCPT ); Mon, 14 Feb 2022 15:57:17 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230025AbiBNU4z (ORCPT ); Mon, 14 Feb 2022 15:56:55 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AD70113DAF; Mon, 14 Feb 2022 12:56:34 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2B5C86116D; Mon, 14 Feb 2022 19:50:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53768C340E9; Mon, 14 Feb 2022 19:50:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644868242; bh=BvxiazElhAHgEm8+2WGMWR3C6ZbhqtLqke0JBRhBcik=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=aEGVTY81UnRVU8bkM8waQP4laPDy37D3Gu8TElITdwX61EGmyK5ZXos2moGKr5Zd2 8MP989zlHrw4km6Qd2cAIkl424Y7mypQq6/Jz4lro7XYz1tVNiF2LHsm/Qlz6eDPDV 3aF55ngK8WxjFvb+1VefzXQCjlDwQtNb96TskP3EFoEWXcOyW6actoyWn7O8aoHusr BU3stTV6VNZ2Y/kFzJ0O5VzJLANKsKxQ9/SvwrQYfOhqFBRwvvuHpW7h/qHcbeOBMa EKZDkio8Fkmf0SxDgGW0obRhFKbjpbAs37b3J2YkEbC42FX+OMt5ljgg5j1O4ZV4k/ VPYggZ5PnzqTw== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 58C4F400FE; Mon, 14 Feb 2022 16:50:40 -0300 (-03) Date: Mon, 14 Feb 2022 16:50:40 -0300 From: Arnaldo Carvalho de Melo To: Ian Rogers Cc: Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Thomas Gleixner , Darren Hart , Davidlohr Bueso , =?iso-8859-1?Q?Andr=E9?= Almeida , James Clark , John Garry , Riccardo Mancini , Yury Norov , Andy Shevchenko , Andrew Morton , Jin Yao , Adrian Hunter , Leo Yan , Andi Kleen , Thomas Richter , Kan Liang , Madhavan Srinivasan , Shunsuke Nakamura , Song Liu , Masami Hiramatsu , Steven Rostedt , Miaoqian Lin , Stephen Brennan , Kajol Jain , Alexey Bayduraev , German Gomez , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Eric Dumazet , Dmitry Vyukov , Hao Luo , eranian@google.com Subject: Re: [PATCH v3 06/22] perf test: Use pointer for maps Message-ID: References: <20220211103415.2737789-1-irogers@google.com> <20220211103415.2737789-7-irogers@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Mon, Feb 14, 2022 at 04:48:35PM -0300, Arnaldo Carvalho de Melo escreveu: > Em Fri, Feb 11, 2022 at 02:33:59AM -0800, Ian Rogers escreveu: > > struct maps is reference counted, using a pointer is more idiomatic. > > > > Signed-off-by: Ian Rogers > > --- > > tools/perf/tests/maps.c | 20 ++++++++++---------- > > 1 file changed, 10 insertions(+), 10 deletions(-) > > > > diff --git a/tools/perf/tests/maps.c b/tools/perf/tests/maps.c > > index e308a3296cef..6f53f17f788e 100644 > > --- a/tools/perf/tests/maps.c > > +++ b/tools/perf/tests/maps.c > > @@ -35,7 +35,7 @@ static int check_maps(struct map_def *merged, unsigned int size, struct maps *ma > > > > static int test__maps__merge_in(struct test_suite *t __maybe_unused, int subtest __maybe_unused) > > { > > - struct maps maps; > > + struct maps *maps; > > unsigned int i; > > struct map_def bpf_progs[] = { > > { "bpf_prog_1", 200, 300 }, > > @@ -64,7 +64,7 @@ static int test__maps__merge_in(struct test_suite *t __maybe_unused, int subtest > > struct map *map_kcore1, *map_kcore2, *map_kcore3; > > int ret; > > > > - maps__init(&maps, NULL); > > + maps = maps__new(NULL); > > Now that is dynamicly allocated we need to check for the constructor > result, I'm fixing this up. I.e. added this: diff --git a/tools/perf/tests/maps.c b/tools/perf/tests/maps.c index 6f53f17f788e7dd7..a69988a89d265211 100644 --- a/tools/perf/tests/maps.c +++ b/tools/perf/tests/maps.c @@ -35,7 +35,6 @@ static int check_maps(struct map_def *merged, unsigned int size, struct maps *ma static int test__maps__merge_in(struct test_suite *t __maybe_unused, int subtest __maybe_unused) { - struct maps *maps; unsigned int i; struct map_def bpf_progs[] = { { "bpf_prog_1", 200, 300 }, @@ -63,8 +62,9 @@ static int test__maps__merge_in(struct test_suite *t __maybe_unused, int subtest }; struct map *map_kcore1, *map_kcore2, *map_kcore3; int ret; + struct maps *maps = maps__new(NULL); - maps = maps__new(NULL); + TEST_ASSERT_VAL("failed to create maps", maps); for (i = 0; i < ARRAY_SIZE(bpf_progs); i++) { struct map *map;