Received: by 2002:a05:7412:b795:b0:e2:908c:2ebd with SMTP id iv21csp555273rdb; Thu, 2 Nov 2023 11:01:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHvQ/3y854Pzfr4kWDoGYhiiAtV+n6W46PRca0D13DSzBL6wGEfoXB96x15cVR2s80mDz8K X-Received: by 2002:a17:90b:684:b0:280:a4a1:5d03 with SMTP id m4-20020a17090b068400b00280a4a15d03mr293576pjz.4.1698948093799; Thu, 02 Nov 2023 11:01:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698948093; cv=none; d=google.com; s=arc-20160816; b=U1F1D8QY429QhHA+lgVB6VicEd3Y08ObE8ehcDOCr5gdAoxbvK4JEa5l8EliGH+mJR vLbnkZJuj0E6qgP8ZrPxZ/BADo4BC2ea75WvvNQE08iWR3K8b/QdjQGIoVv8Prl2+kRU X+Ib2CPc3W6wxYBIb3+QAmMhazeUYMRwAh9WSQ2C1jsOAkgEOPrYZpP46g4HootoI0Wd w8TxRbpgVKQ7ZpOTOd245wjPJDA7L6cNdvUjclJSbeqPnAAhANu9kmvopTlcXHLq2tjF 4gVg6xVBEl2kKhH3D4BncUaSzLZp+CxctPJabQZ5Y6mEjcIYAg1XyZmy+t5qn45+XEP/ QiYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=BZFU+q33RyXycgTF/0yPGI/OvtojYXelKAaBBZD0UYI=; fh=z1KcSqUpYQ9oC4uLSeIkhAYTnJ2bvP0QbNW2xqV5NqA=; b=a3bJ0mXF0WZMgpFeIe0aZKFYgeGf5QZ5yeM6O2V55T0tsEgjFS9C4Ua3tmg9P00VEM yTyZZPw6OUMLXfHLZVFQUiTTOP0COi9rE0QDRBy+01hWaerxRIBd3r0/xH0rPgbZ8lwQ xAFQ78QDvmSAa0+a15WaoMNyK+6tyNG6DVyvUvJBgZ6A/oU2fufcCtwWczmRQlTUbUsF KdTo/SKIY5sr746GGnbK/gCVn3tIxCXK3eJpf37zk+shnHwBUxbunxYwlFklqkYNYl1w KUpbCrrx5KdjhInLadkJnQ1k39pZkzzmsdFA2uxPq7tN0o6AnkyMMwil9CNDbpm7AY/T VoBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="Uy1/4wIQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id ha10-20020a17090af3ca00b002791035445esi105187pjb.76.2023.11.02.11.01.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 11:01:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="Uy1/4wIQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id 1FE1180DF98A; Thu, 2 Nov 2023 11:01:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376807AbjKBSAW (ORCPT + 99 others); Thu, 2 Nov 2023 14:00:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234703AbjKBR7q (ORCPT ); Thu, 2 Nov 2023 13:59:46 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D511D5C for ; Thu, 2 Nov 2023 10:58:54 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-5acac8b6575so18561067b3.1 for ; Thu, 02 Nov 2023 10:58:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698947933; x=1699552733; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=BZFU+q33RyXycgTF/0yPGI/OvtojYXelKAaBBZD0UYI=; b=Uy1/4wIQ2Zpn6AINY6D37TWT4iyK51U8RCrIyNyk+eDSE2fznI4saKcPwhGBGBd+rR RMpyo85gqRSGz92uC7BmW6B0qNP9w47stKPPTiSmElYmYYeHsRyM8HpH6AAqa4WGHo4E WTYmo6gCfI/Zmy/v3Y3W6EVWttLFAZ3jvuz3acfIAFHUTHe7bqUPf+kcX9+vV6MNPaWL WL+OUBuS1UBoW2Q4oL4gUAX5AM5m3Rk4oZ/Mn7OodAMpkTFxgxcjHzicjXGYNflrKpGG 4DDGROgxArxknCBBSKbToWWhSotYoQROym4Tf6RfnlHTjFIwRq488mU3iZe8qkH3leeA EF8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698947933; x=1699552733; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=BZFU+q33RyXycgTF/0yPGI/OvtojYXelKAaBBZD0UYI=; b=h6SCotDIV21Z0pFBlNHEks+UPrMs4Gw8CebgbhnjiFeF+4zngxglEjhdrd+3ee3s55 8tgKneXmuPS47TR7IMswS/60Ui88gfsvQVRX5D2rHVwgcJqVx67hlaBfrGFziOQ86L4j UeGyGzDKEcfAjX7OS5OwUth3nJ5AnRCWNgadWhp9rkzCJ6rM65T8ASXIiXj9u1bsdt2D 7ohVHtnxc+F8ipzq/onhOeF1mrkcOZbgWlTxz+SdKBdmSmM89e/zjLj5+Jc8wb1rps3i Hz1Za175UNFYTTkA22EkhxTou84Rdk1D1bRNXpFbvbzkmJBl8iyCmmi92dcV6Aof7tvz 6dVw== X-Gm-Message-State: AOJu0Yyc7AZQS4S18DR/OAA4Xu2D8SZolte8OFhm4CFaDbDS8NiwF8gV ewy3tz2KsGIAzSoak4qkms5baZiq8kCG X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:bb34:df9c:836c:afca]) (user=irogers job=sendgmr) by 2002:a05:690c:3690:b0:5ae:75db:92c5 with SMTP id fu16-20020a05690c369000b005ae75db92c5mr5517ywb.2.1698947933554; Thu, 02 Nov 2023 10:58:53 -0700 (PDT) Date: Thu, 2 Nov 2023 10:57:07 -0700 In-Reply-To: <20231102175735.2272696-1-irogers@google.com> Message-Id: <20231102175735.2272696-26-irogers@google.com> Mime-Version: 1.0 References: <20231102175735.2272696-1-irogers@google.com> X-Mailer: git-send-email 2.42.0.869.gea05f2083d-goog Subject: [PATCH v4 25/53] perf maps: Add find next entry to give entry after the given map From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , 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 Content-Type: text/plain; charset="UTF-8" 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 groat.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 (groat.vger.email [0.0.0.0]); Thu, 02 Nov 2023 11:01:11 -0700 (PDT) Use to remove map_rb_node use from machine.c. Signed-off-by: Ian Rogers --- tools/perf/util/machine.c | 7 +++---- tools/perf/util/maps.c | 11 +++++++++++ tools/perf/util/maps.h | 2 ++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 191e492539e5..ab345604f274 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -1759,12 +1759,11 @@ int machine__create_kernel_maps(struct machine *machine) if (end == ~0ULL) { /* update end address of the kernel map using adjacent module address */ - struct map_rb_node *rb_node = maps__find_node(machine__kernel_maps(machine), - machine__kernel_map(machine)); - struct map_rb_node *next = map_rb_node__next(rb_node); + struct map *next = maps__find_next_entry(machine__kernel_maps(machine), + machine__kernel_map(machine)); if (next) - machine__set_kernel_mmap(machine, start, map__start(next->map)); + machine__set_kernel_mmap(machine, start, map__start(next)); } out_put: diff --git a/tools/perf/util/maps.c b/tools/perf/util/maps.c index 9a84d26328a7..38d56709bd5e 100644 --- a/tools/perf/util/maps.c +++ b/tools/perf/util/maps.c @@ -662,6 +662,17 @@ struct map *maps__find_by_name(struct maps *maps, const char *name) return map; } +struct map *maps__find_next_entry(struct maps *maps, struct map *map) +{ + struct map_rb_node *rb_node = maps__find_node(maps, map); + struct map_rb_node *next = map_rb_node__next(rb_node); + + if (next) + return next->map; + + return NULL; +} + void maps__fixup_end(struct maps *maps) { struct map_rb_node *prev = NULL, *curr; diff --git a/tools/perf/util/maps.h b/tools/perf/util/maps.h index b7ab3ec61b7c..84b42c8456e8 100644 --- a/tools/perf/util/maps.h +++ b/tools/perf/util/maps.h @@ -136,6 +136,8 @@ int maps__fixup_overlap_and_insert(struct maps *maps, struct map *new); struct map *maps__find_by_name(struct maps *maps, const char *name); +struct map *maps__find_next_entry(struct maps *maps, struct map *map); + int maps__merge_in(struct maps *kmaps, struct map *new_map); void __maps__sort_by_name(struct maps *maps); -- 2.42.0.869.gea05f2083d-goog