Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1326146rdb; Wed, 6 Dec 2023 15:52:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IH5PWQK44F85sppfumadLBFRJtktGeaRHfgtTAvH5IPJzxkWMPbfTJ9ogry5qIYLVH4AwTO X-Received: by 2002:a05:6a00:2d89:b0:6ce:2731:47b9 with SMTP id fb9-20020a056a002d8900b006ce273147b9mr2121328pfb.25.1701906747890; Wed, 06 Dec 2023 15:52:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701906747; cv=none; d=google.com; s=arc-20160816; b=toMBeWE0Wgt6WdmBT5SMawSgpkCGTGIpxoTHnSMAAlN1b+RYGt/u2+NHoiQlrxxSw+ zZBCembSaTvVi2FkTF8gFqweHDSoIE/1GWFp7AfBKe74grWp7dfzfpA9IezBXkbQLxZz 23lxwkqaY+PUja0/CTR1kDl+cnH6c9Lr5/PjVDf72DD9LSG/kKxIvUfuQ/kRVjH8OsPT knKM63DUc8T/BTrbRpR0JartQh99d7TYYEzD4pIkCF7yb9sxKW93eqNy5OfXgppJtAq0 NEyn5fTiDgaAcan22aul2tC9BN7iF5Wb4f2ucm5Fa0CHBVdzpTbtucW9N5XjFb9E8s92 KhRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=9JRy9QKnZQ2wD2vqqNpyfc7KXoHKfLLWhWrukAC+2vc=; fh=zt+aMtm74o2VDnWd+fyn50LeDgsHvuUMqskurVhx6uc=; b=DWwP6IW620/uhbKGWpOk36503Zd3l7zFxWKCH8gcZkhXRRymG/Ibz/FLvJVOn40+P/ DkWF4b+OpoD8TfgqeAzD6i1qurHvt+fX2gvhoZ22GwUJ2dv5ZbLHMFjS0uPBPnIdWede o5nJZLC5IVWdY4r6EhKlk8Xo+YtERhK1Qr68Q9sFNQYQ0bcX4g0KFHijSmKCqIe+jQfA QB7C3cgU+mlEx3bk1RRrgGTcYfdp0tx7nkTCCf4IdvdrPyHh8kf68OYrj1jfKCSF50KQ zCSEN1eezjTQ5iUUBTQCb7a21UExsN8+vMsZOEMBBZ+yCW6ny8n9xd49r9nAh2M20Ysu I6Gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=kiTSkIrk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id a16-20020a056a000c9000b006cbd28f1f43si156286pfv.47.2023.12.06.15.52.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 15:52:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=kiTSkIrk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 3AABB802E899; Wed, 6 Dec 2023 15:52:25 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1441805AbjLFXwI (ORCPT + 99 others); Wed, 6 Dec 2023 18:52:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230401AbjLFXwH (ORCPT ); Wed, 6 Dec 2023 18:52:07 -0500 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11FE0A4 for ; Wed, 6 Dec 2023 15:52:13 -0800 (PST) Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-50bf1de91c6so688e87.1 for ; Wed, 06 Dec 2023 15:52:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701906731; x=1702511531; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=9JRy9QKnZQ2wD2vqqNpyfc7KXoHKfLLWhWrukAC+2vc=; b=kiTSkIrk08zMvTsY/u2jWGsb4ACBmhuqNYJ7P+bt3sZZ+9tBDbPdNXE0diGUi9w1Rd iImQV5tpwooNDJCrsbZG9t6eBglaDPHwKupm7Jw1oOiRMq+MRrqFRcj8Uf2STpPOOqU7 RFbWnquS6wxX8cOe/0DntUN9vDfcEVdEM+Mquo8IdnK0fY8ordq1O4CnAb6esq+SbnKe q+pKqGbjdyQREF3RmJgnsCo7cpTsOHpYHaiLECl8l+bTp+wdbu0wjP4jt4a3SDIj7Ddp C+238cze1wKBTGdGGMJGDWKzPWLh3gwWfgbXdzxWDZTQ+hEx+0Ecg6e4JmJbqpNh27bD w9+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701906731; x=1702511531; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9JRy9QKnZQ2wD2vqqNpyfc7KXoHKfLLWhWrukAC+2vc=; b=mg2iSzyRH/RUncrT8iD4s+SYB1P/cE0o981JCRFRVps1p4oIRwfVWnAhSKlnQ4gnuc mgdtKvRtJpAHYaFsetw51WcT1vICNt/cVKXyvwdpgwv7CHtPbY7Oq3u4RpcdLv2eFJCP YJvJYQDxCKU1tajgO3YKrenVxLwUP+aefkWVH1d/mbRG7ub+YVaFjerbsgt0nIM/A6jb gJUDCRducvsI/0AtEn3XDKQAS5C8k5fUZVYKc5ABAIjH5vMd28CHcRJe9ojuG49EZThA ANXdO669PqIE4I9a9vs/kQiPMCK7Yu8zyK1PltIFFu/8PMXze57LhDdImojyOLao6qVp 6SvA== X-Gm-Message-State: AOJu0Yy3fEyz6KevEKH0aPGiWiUT/1mBMSsiF155xs8mBEzTKwfszzIH 8qz2mhoolrTgbFPQUEynQVMZ3r6Mfq4ZLRIxlpHJpQ== X-Received: by 2002:a05:6512:90e:b0:50b:e8ea:ad with SMTP id e14-20020a056512090e00b0050be8ea00admr93855lft.0.1701906731080; Wed, 06 Dec 2023 15:52:11 -0800 (PST) MIME-Version: 1.0 References: <20231127220902.1315692-1-irogers@google.com> <20231127220902.1315692-20-irogers@google.com> In-Reply-To: From: Ian Rogers Date: Wed, 6 Dec 2023 15:51:58 -0800 Message-ID: Subject: Re: [PATCH v5 19/50] perf maps: Do simple merge if given map doesn't overlap To: Namhyung Kim Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , Nick Terrell , Kan Liang , Andi Kleen , Kajol Jain , Athira Rajeev , Huacai Chen , Masami Hiramatsu , Vincent Whitchurch , "Steinar H. Gunderson" , Liam Howlett , Miguel Ojeda , Colin Ian King , Dmitrii Dolgov <9erthalion6@gmail.com>, Yang Jihong , Ming Wang , James Clark , K Prateek Nayak , Sean Christopherson , Leo Yan , Ravi Bangoria , German Gomez , Changbin Du , Paolo Bonzini , Li Dong , Sandipan Das , liuwenyu , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Guilherme Amadio Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 06 Dec 2023 15:52:25 -0800 (PST) On Mon, Dec 4, 2023 at 4:06=E2=80=AFPM Namhyung Kim w= rote: > > On Mon, Nov 27, 2023 at 2:10=E2=80=AFPM Ian Rogers w= rote: > > > > Simplify merge in for the simple case of a non-overlapping map. > > > > Signed-off-by: Ian Rogers > > A nitpick below. > > > --- > > tools/perf/util/maps.c | 11 +++++++++++ > > 1 file changed, 11 insertions(+) > > > > diff --git a/tools/perf/util/maps.c b/tools/perf/util/maps.c > > index 40df08dd9bf3..14e1a169433d 100644 > > --- a/tools/perf/util/maps.c > > +++ b/tools/perf/util/maps.c > > @@ -696,9 +696,20 @@ void maps__fixup_end(struct maps *maps) > > int maps__merge_in(struct maps *kmaps, struct map *new_map) > > { > > struct map_rb_node *rb_node; > > + struct rb_node *first; > > + bool overlaps; > > LIST_HEAD(merged); > > int err =3D 0; > > > > + down_read(maps__lock(kmaps)); > > + first =3D first_ending_after(kmaps, new_map); > > + overlaps =3D first && > > + map__start(rb_entry(first, struct map_rb_node, rb_node)= ->map) < map__end(new_map); > > Can you please break this like below? > > rb_node =3D first ? rb_entry(first, struct map_rb_node, rb_node) : NU= LL; > overlap =3D rb_node && map__start(rb_node->map) < map_end(new_map); Done in v6. Thanks, Ian > Thanks, > Namhyung > > > > + up_read(maps__lock(kmaps)); > > + > > + if (!overlaps) > > + return maps__insert(kmaps, new_map); > > + > > maps__for_each_entry(kmaps, rb_node) { > > struct map *old_map =3D rb_node->map; > > > > -- > > 2.43.0.rc1.413.gea7ed67945-goog > >