Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1362369rdb; Wed, 6 Dec 2023 17:19:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IHt84pmUojMqRY2RNtkRAd808z/150tzTxk70/OV9UdlKUEA/LdUi9mnMSpM8mJQZsdAreE X-Received: by 2002:a05:6358:60c1:b0:16e:2740:7cfc with SMTP id i1-20020a05635860c100b0016e27407cfcmr1970995rwi.25.1701911963651; Wed, 06 Dec 2023 17:19:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701911963; cv=none; d=google.com; s=arc-20160816; b=MtT/rxoBEWm/2H5sFcKOYv4vjC2QqDbU63izDE5z5T9SPI23CndkqtXBDiKt+Sv4AV Pgn6vNGez6It8G1huELWiLhGCyMg5QcIysFJ/wDhhkizWBKKbhiF9mbMpOK6HnXSPMy3 0dzFtNvct231e8jdCfXxNZN7DfRZqsaxrAbQJCA058f8PYdArQLJlgZqszeS4YiLJNw7 5516SP1ENkHT7Lqc/xmVoQgBaddMlJFh85Ldaj0JMRP6lqvf7KTiJokuYRZd5SUwVX2u DXo6m7BcP+gIfaQhst6NXFHF38zmH7JwI4W4TCB3FTWy6BbTTkVGvYTgRL0B2jj2NRPF tBYw== 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=LdvL5AMgGawz38PbKP6bJb9rCM4m4RVHx/ZUCFaT4KI=; fh=Io7x3OacpefNRRNKoYAzVE0aWTDwD7FRzyCdD1e3AN4=; b=O4paS44EeGmj3YBuWb7WFK47ju0BELNtPYSaxDIkkOK/Ox3Ox4KRRG0sL2mbuLOhbU kODfPl51j0sUxjryd+tjWXPkdpi0/UVyYCskqvQXfyTVGWL3romYvjlRqWIojwy2oJAf UVnyyXQ3OvMF/6PMKIv97/h4KcnjCxn525FMSacuB15CD2AzIp0tyvj+9e+CRJutK/53 901IHWhqb6kDX3TNjd5dfM1H2iOdWFtwoS+CemE106bJ6QKSQ2YjPaGTH2xrjZEswa+3 kw0Bw5RBQeuG/pvzNrjYadzh3ex7Kjq5tEZox7nd0ua2j+Df0U/aafzT6BIrLzEop87Q K6gQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=eIalGa6N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id w67-20020a636246000000b005c66e00ffccsi199571pgb.260.2023.12.06.17.19.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 17:19:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=eIalGa6N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 1AC0F8021388; Wed, 6 Dec 2023 17:19:15 -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 S1441961AbjLGBSl (ORCPT + 99 others); Wed, 6 Dec 2023 20:18:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442038AbjLGBS2 (ORCPT ); Wed, 6 Dec 2023 20:18:28 -0500 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1F4519BD for ; Wed, 6 Dec 2023 17:18:02 -0800 (PST) Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-db402e6f61dso534596276.3 for ; Wed, 06 Dec 2023 17:18:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701911877; x=1702516677; 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=LdvL5AMgGawz38PbKP6bJb9rCM4m4RVHx/ZUCFaT4KI=; b=eIalGa6NBwURfR5gfFD2dyslg5agUniNKtTQ8ta8R7nV/ESDmICnC4+fOyBtlZnAU4 i8UYi6dXHUPHdtz3Zf4+D40x+Wn0piod5nKWjbyYEeo4CsdrEINAGtzSdWpnkXTZewIJ jK0moWyDeX0I77URJ8Fi5RXsm6e2e3DhD6rQ1K/z/WMVXGfisKNc9Tzo/iUR4TijTBV5 qqIzedjic8hvVuPvLW1x94vplPk2o5Tu0+BNQHjBJebe/HDpnBxStBGoLksAZx3pAFzA WpLQC0BhtUKlCankJwjT5yIbUA8Me1Y7+w8V3IQvtpJrEKWiBTRVnDlSN2Xecj9nt9hx UuVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701911877; x=1702516677; 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=LdvL5AMgGawz38PbKP6bJb9rCM4m4RVHx/ZUCFaT4KI=; b=ouiMxOgs0+O7Lj/pApt+nfkS/eocTMcqqxYAkzC6zewXAWnZBJZ0r00nUMG4qvs8DA xtd4Ds2aTPRLbEo/QJos3huIZ2y3CY+ypW/NI+17RYugWGG6T69KAXUqbr5WY4cgJwim 4nu5pjbmHIPZ6xc0zfPcrp/c2l6964kTrqWW1NeO8I0BoxtdwpJE9FStFKZsDqj0dej+ SqsClOQ/j2niVbjdywGf+0sBfWnQeSCb1ieVKTvAerqh9oGjH8pCKrXgURJum42r9hJC Uo2YLH1jHWPuRQclZf+XsVpww+Plk/NrolHGYvBOuVbhDK+3b+TYNhai5z1D1R4zZBG0 68wA== X-Gm-Message-State: AOJu0Yxj8mZynRO55ub45jIjH36+l3zfp330xNLMmGySfQ+ed6K2zJnN LxrhqxkKbaGwHFUfq8pEedUXRYYhpruc X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:35bf:293e:7696:34e9]) (user=irogers job=sendgmr) by 2002:a25:ccd5:0:b0:daf:6333:17c3 with SMTP id l204-20020a25ccd5000000b00daf633317c3mr24166ybf.1.1701911877641; Wed, 06 Dec 2023 17:17:57 -0800 (PST) Date: Wed, 6 Dec 2023 17:16:47 -0800 In-Reply-To: <20231207011722.1220634-1-irogers@google.com> Message-Id: <20231207011722.1220634-14-irogers@google.com> Mime-Version: 1.0 References: <20231207011722.1220634-1-irogers@google.com> X-Mailer: git-send-email 2.43.0.rc2.451.g8631bc7472-goog Subject: [PATCH v6 13/47] perf maps: Reduce scope of maps__for_each_entry 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, Guilherme Amadio 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 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 17:19:15 -0800 (PST) Reduce scope of maps__for_each_entry as maps__for_each_map is a safer alternative holding the maps lock during iteration. Signed-off-by: Ian Rogers --- tools/perf/util/maps.c | 3 +++ tools/perf/util/maps.h | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/maps.c b/tools/perf/util/maps.c index 160a6dce54bb..00e6589bba10 100644 --- a/tools/perf/util/maps.c +++ b/tools/perf/util/maps.c @@ -10,6 +10,9 @@ #include "ui/ui.h" #include "unwind.h" +#define maps__for_each_entry(maps, map) \ + for (map = maps__first(maps); map; map = map_rb_node__next(map)) + static void maps__init(struct maps *maps, struct machine *machine) { refcount_set(maps__refcnt(maps), 1); diff --git a/tools/perf/util/maps.h b/tools/perf/util/maps.h index 14ad95979257..8ac30cdaf5bd 100644 --- a/tools/perf/util/maps.h +++ b/tools/perf/util/maps.h @@ -36,9 +36,6 @@ struct map_rb_node *map_rb_node__next(struct map_rb_node *node); struct map_rb_node *maps__find_node(struct maps *maps, struct map *map); struct map *maps__find(struct maps *maps, u64 addr); -#define maps__for_each_entry(maps, map) \ - for (map = maps__first(maps); map; map = map_rb_node__next(map)) - #define maps__for_each_entry_safe(maps, map, next) \ for (map = maps__first(maps), next = map_rb_node__next(map); map; \ map = next, next = map_rb_node__next(map)) -- 2.43.0.rc2.451.g8631bc7472-goog