From nobody Wed Dec 17 12:44:25 2025 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 018BFC4167B for ; Mon, 27 Nov 2023 22:11:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234226AbjK0WLJ (ORCPT ); Mon, 27 Nov 2023 17:11:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233867AbjK0WKe (ORCPT ); Mon, 27 Nov 2023 17:10:34 -0500 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A5281701 for ; Mon, 27 Nov 2023 14:10:11 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-db3ef4c7094so5513143276.1 for ; Mon, 27 Nov 2023 14:10:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701123010; x=1701727810; 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=Xp8iIxo035oHbvCFG1UawGFv2rk11B4jTXVswVvjASk=; b=BUrE4/XMQNQ1Ra4CBGM1v3cF4C7O32Gl+n96nIN4DM6rc1W2CzhsGnHacDEPHyU5X6 15RKWKSch4tTWHHa1f5wq0xKJGfdI57w7vWHmc5lNizb2sjj5r5bsoAK3vsLfmpta9tM dAhJPfivtEt2QWVn6acsGOeZZ4KVxxvl9TYS/2xi9Plam4LTGEnEwKe1pmu6txI0iT6s ONpZ2Gl15Oms1QYGJ6TPTle+HG/2mwIZsrNpeUMROa4gLCKOk1ONyhQZU8iE05JZdNvG SM0NJbeqN3WvECRIthmYl9dO+aySHjRsPasf/EyqEnwD7i6LfKE9+E7UjkIVJ+pa0RTj 4IHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701123010; x=1701727810; 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=Xp8iIxo035oHbvCFG1UawGFv2rk11B4jTXVswVvjASk=; b=a/sEbeEdEnLwd2WDq2DydzndIHbCVPlLgIdb7cO5xCEh/oERilPYYkOmn9oEwUMT/x klSE6GNswri/2jzxb1UqJ1BA+RcJb1SbFc5CfgACcRdsBoDFNLVY1AdzEnWLcsI8THC/ WcwJK7FQcLVWSYmlMv1VkXgyPu1L7u2gsv9PSYo1k8teXv80VRbxqIPYr1CmC/I6iQM9 5G+o5EjUpMXR5Jv63JV55UBILLWl+zbNO8lgZgRh9zco/mxxA23BdQ+J6Y+s/atJtrQF bC1BtD/bAhLL1Fuo3zp09REQseIpVV7kmKiAgnoQ4GlU9wXI9tgtJCOyzz+fvHP4wa66 7E2w== X-Gm-Message-State: AOJu0YySy4An5rRKPzhnF01mkJmS582GcR71iHuZKx9ViciIhzViacqH XADo0O6XQ7WRxMnUUtQuxwHWalWlQOQa X-Google-Smtp-Source: AGHT+IGeyyQaMmLbqCN92w+hBxIYvS3reZkb5q+BcPSfsU7r0C55NGH7xLQ0bx7pKgMF4gkf9x+xa70Lb3Pt X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:829:6e77:9093:f39b]) (user=irogers job=sendgmr) by 2002:a25:3383:0:b0:da0:c6d7:8231 with SMTP id z125-20020a253383000000b00da0c6d78231mr445480ybz.0.1701123010280; Mon, 27 Nov 2023 14:10:10 -0800 (PST) Date: Mon, 27 Nov 2023 14:08:32 -0800 In-Reply-To: <20231127220902.1315692-1-irogers@google.com> Message-Id: <20231127220902.1315692-21-irogers@google.com> Mime-Version: 1.0 References: <20231127220902.1315692-1-irogers@google.com> X-Mailer: git-send-email 2.43.0.rc1.413.gea7ed67945-goog Subject: [PATCH v5 20/50] perf maps: Rename clone to copy from 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Rename maps__clone to maps__copy_from to be more intention revealing of its behavior. Pass the underlying maps rather than the thread. Signed-off-by: Ian Rogers Acked-by: Namhyung Kim --- tools/perf/util/machine.c | 2 +- tools/perf/util/maps.c | 6 +----- tools/perf/util/maps.h | 3 +-- tools/perf/util/thread.c | 2 +- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 3c967295c9a3..191e492539e5 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -454,7 +454,7 @@ static struct thread *findnew_guest_code(struct machine= *machine, * Guest code can be found in hypervisor process at the same address * so copy host maps. */ - err =3D maps__clone(thread, thread__maps(host_thread)); + err =3D maps__copy_from(thread__maps(thread), thread__maps(host_thread)); thread__put(host_thread); if (err) goto out_err; diff --git a/tools/perf/util/maps.c b/tools/perf/util/maps.c index 14e1a169433d..85bea2a6dca9 100644 --- a/tools/perf/util/maps.c +++ b/tools/perf/util/maps.c @@ -452,12 +452,8 @@ int maps__fixup_overlap_and_insert(struct maps *maps, = struct map *new) return err; } =20 -/* - * XXX This should not really _copy_ te maps, but refcount them. - */ -int maps__clone(struct thread *thread, struct maps *parent) +int maps__copy_from(struct maps *maps, struct maps *parent) { - struct maps *maps =3D thread__maps(thread); int err; struct map_rb_node *rb_node; =20 diff --git a/tools/perf/util/maps.h b/tools/perf/util/maps.h index 62e94d443c02..e4a49d6ff5cf 100644 --- a/tools/perf/util/maps.h +++ b/tools/perf/util/maps.h @@ -14,7 +14,6 @@ struct ref_reloc_sym; struct machine; struct map; struct maps; -struct thread; =20 struct map_rb_node { struct rb_node rb_node; @@ -61,7 +60,7 @@ struct kmap { =20 struct maps *maps__new(struct machine *machine); bool maps__empty(struct maps *maps); -int maps__clone(struct thread *thread, struct maps *parent); +int maps__copy_from(struct maps *maps, struct maps *parent); =20 struct maps *maps__get(struct maps *maps); void maps__put(struct maps *maps); diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c index 3d47b5c5528b..89c47a5098e2 100644 --- a/tools/perf/util/thread.c +++ b/tools/perf/util/thread.c @@ -390,7 +390,7 @@ static int thread__clone_maps(struct thread *thread, st= ruct thread *parent, bool return 0; } /* But this one is new process, copy maps. */ - return do_maps_clone ? maps__clone(thread, thread__maps(parent)) : 0; + return do_maps_clone ? maps__copy_from(thread__maps(thread), thread__maps= (parent)) : 0; } =20 int thread__fork(struct thread *thread, struct thread *parent, u64 timesta= mp, bool do_maps_clone) --=20 2.43.0.rc1.413.gea7ed67945-goog