Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp568328lqp; Thu, 21 Mar 2024 09:05:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVtQucip2ZX60vN8R9wwcq9qMZu58AV0DBVevJlgLp6MgiXqrcKvFme6ahzChpRsQaML3hJnvXvniDoLJGIn2bd5g+ivJg9G8JoOs6sYA== X-Google-Smtp-Source: AGHT+IGbWqFh9BTgkDUVXjhQvC1oxPyNkCi0Um1nKINzZndZ1xqy2/5R/KBUsN/k3hn39xUQIAMY X-Received: by 2002:a17:907:1b03:b0:a46:e51a:466e with SMTP id mp3-20020a1709071b0300b00a46e51a466emr7169911ejc.64.1711037143189; Thu, 21 Mar 2024 09:05:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711037143; cv=pass; d=google.com; s=arc-20160816; b=SI2GCHWQxzmOS7h/vhL+JBKyeN0CAnRa05Iet96CQuxbNlROFJpnKzigGxNLPYaXH8 OgoDLGJ5+UejRn7/dBsCJSE7XG+jjcakAwyYIl6S6/1gIIyl3wlmrweacfM8zJznqEd2 b0ToKA1ZJtMWXaCpjr7qzqJi9A69ZENvQy8pJSsRfrnukgFkqq5EUFjH+5u0QB40v/tL PHMI2EBSGs3cNXJSwvH0c83cp7oFjDF1rtfZDDZ8bTAW4aP25WG6zwzwgEM3dWJUEPRP GyZlu/HJWK7IzlzTOp/McbP6eW6JLgRKpFLD+G5K4AA3f7Iwd1NFsC4p2EEg/JXqrXh9 757A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:from:subject:references:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:in-reply-to:date :dkim-signature; bh=Qb34hunpitkV9KyM24uyeOBHfw4J/ByrLgEYhlQl+E4=; fh=p8Hw43U4VqZuZBQh9hlAcXNiDnp8OaIbTxLjiqLg3Aw=; b=U7HyXdGA9rztrh9gwIkjuwzpUYSD69ouF8JkahINGLnuA2xoTIJ/egHaXVRXfPjuqj 4bnypxh6z0N3Lw+0R0gtFsXc6CgjqyZRtLMtT9haJxU1Ts9iRTRyWC2dRvFImtWWWtJA xPfU0GVGxOhCM58HbGYAwrjtReloRdorJTbazC6aubCTPx1A2MtJsZRguyBg3tVpfbiz DXKgUuc4e0pHpZBuF7FZBeN2eQBhFEZxz1Y5FAT8Dtmz7jDssE74QH06QRL4C3GmGk26 ahfNhvWOoyrl83oljQN8WzneHWnAN+RUmYbZDTEh4BMmcDQnKAgsujEIeIi3irCtedDG WATg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=hi37OlOr; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-110304-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-110304-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id bq21-20020a170906d0d500b00a4669ed7188si45642ejb.1023.2024.03.21.09.05.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 09:05:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-110304-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=hi37OlOr; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-110304-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-110304-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A60451F21E61 for ; Thu, 21 Mar 2024 16:05:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 682C512D75C; Thu, 21 Mar 2024 16:03:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="hi37OlOr" Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5546712D20A for ; Thu, 21 Mar 2024 16:03:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711037013; cv=none; b=MWiyHtLik20NvGv9kzFtdK+X+cP7sMMH3K+WZ9JYKmrbH3onDaSgPOCXeBUtSJkRBfr9sFaP/t+sWhU/Zds+9A046ez3BdwtlBL0MAMxvqUKH6kjEU9mwgJl3l1bj9RiBXeBEmhwNHUNARKbhefg0pX2N7E8c0OaGN3qfq9IdSw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711037013; c=relaxed/simple; bh=3gSnYwZVx0I+sEaou2QDUcUWPJPDhp1y08jtX5P7qHA=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=Wrf0Bb9nbikiOKlF7RlomhwXTHwlEznyFSldTo0BzOjuL+aDIzI8lFTCKUiKkOh6GzMsax7OQ/VvjBC7uN2kxdq2QOQ7VGaUR3Sk9/OiFElfmZYMm1EWvL4Pd//qhE0frUiAWqHLOvDMR3iPP1vK5TyWkdRd0PzE1EcU5fs/w5M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=hi37OlOr; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dc6b26783b4so1317728276.0 for ; Thu, 21 Mar 2024 09:03:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1711037010; x=1711641810; 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=Qb34hunpitkV9KyM24uyeOBHfw4J/ByrLgEYhlQl+E4=; b=hi37OlOrl3pwBswv/NM+alweu+eGceTtlKwTgINUuqSvFwrcMtJrDj5KbycTKVBH+o gacAD3ENeRTurryyutEb7B8PMDEj6P4BFPr96yqn41YWf758PgVujNCI5yw45BTcP+rB 9Be+0ZdNvWbGbJYG8dc+ttpEispqkpj9L0dMEywj6pL2t9LVTn9d4wKqjqgeQc5ALKtv JSmLCCAloaIMw/Ao2X5wqvVuJXg6Hk93TNswKBUThgFSfPDI/ifvoKNBXOdveuFU8Zcx CwY1dybm4PGnSAVjDcLddJ8VQsMxWdqCGqf6LO/JQ0OWiHvRdONsM0KYbtvzAFuUxp4z vGiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711037010; x=1711641810; 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=Qb34hunpitkV9KyM24uyeOBHfw4J/ByrLgEYhlQl+E4=; b=hWFpx+8p4QG+sAZF/zqCGcVpLgU5DboThIX9akRn23w1ZAj9PbZfxHZ1ALqUlSiLm7 uRDi/+tMahrn6qdkb6XjRP2vXE/1uMxJyQNkaoYjSgxQ1GUvc+0gsgBY0Rh3Cm39WbY8 Rlwrh9GXqaNNyDY8hRQ1LH8dLPcwT1lv6s7Koe5kOnaIb8WIANO0uTG2oDazBBLouIz3 HlIfsRTMwBwVm1xXoNNbx37DgdiBbVzwmVzblQDmXzx9QZmOs5q5Fu5K0w7ZbubYrk3n DYSfEvXCy/P8RnH/GoeAVFcnFjz85NjUrmnLBQixIcwS9vSwinRFxGa4YCP8VLgU2Czh 1itg== X-Forwarded-Encrypted: i=1; AJvYcCUz7t+Y7NpetN3fKVUli/Yltt9K1naSaj3AJrKKPE7/y5yERNtVq40nuBDmQpu8kei6qF4q8XLYWmcMUpXkECENUrqye9hoisZASTkt X-Gm-Message-State: AOJu0YzLcohQKCAYVsoCCRsmykinAioLnr2g/NuJuKLj4M8iuTLt1GyT YbwF7IqKVxVlndXlwpiIYxn2yT0S0++cWAoApihM4yfbqziQDmVKbFaL+Q87FacZcXQXaB1oOCi eXw30hw== X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:7f3:cf74:42c4:c0a]) (user=irogers job=sendgmr) by 2002:a05:6902:983:b0:dd9:489d:da74 with SMTP id bv3-20020a056902098300b00dd9489dda74mr335436ybb.13.1711037010253; Thu, 21 Mar 2024 09:03:30 -0700 (PDT) Date: Thu, 21 Mar 2024 09:02:56 -0700 In-Reply-To: <20240321160300.1635121-1-irogers@google.com> Message-Id: <20240321160300.1635121-10-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240321160300.1635121-1-irogers@google.com> X-Mailer: git-send-email 2.44.0.396.g6e790dbe36-goog Subject: [PATCH v2 09/13] perf dsos: Remove __dsos__findnew_link_by_longname_id From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Athira Rajeev , Colin Ian King , "=?UTF-8?q?Ahelenia=20Ziemia=C5=84ska?=" , Leo Yan , Song Liu , Miguel Ojeda , Liam Howlett , Ilkka Koskinen , Ben Gainey , K Prateek Nayak , Kan Liang , Yanteng Si , Ravi Bangoria , Sun Haiyong , Changbin Du , Masami Hiramatsu , zhaimingbing , Paran Lee , Li Dong , elfring@users.sourceforge.net, Andi Kleen , Markus Elfring , Chengen Du , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Function was only called in dsos.c with the dso parameter as NULL. Remove the function and specialize for the dso being NULL case removing other unused functions along the way. Signed-off-by: Ian Rogers --- tools/perf/util/dsos.c | 51 +++++++++--------------------------------- tools/perf/util/dsos.h | 6 ----- 2 files changed, 10 insertions(+), 47 deletions(-) diff --git a/tools/perf/util/dsos.c b/tools/perf/util/dsos.c index 1495ab1cd7a0..e4110438841b 100644 --- a/tools/perf/util/dsos.c +++ b/tools/perf/util/dsos.c @@ -119,11 +119,6 @@ static int __dso__cmp_short_name(const char *short_name, struct dso_id *id, stru return rc ?: dso_id__cmp(id, &b->id); } -static int dso__cmp_short_name(struct dso *a, struct dso *b) -{ - return __dso__cmp_short_name(a->short_name, &a->id, b); -} - static int dsos__cmp_long_name_id_short_name(const void *va, const void *vb) { const struct dso *a = *((const struct dso **)va); @@ -143,20 +138,21 @@ static int dsos__cmp_long_name_id_short_name(const void *va, const void *vb) * Either one of the dso or name parameter must be non-NULL or the * function will not work. */ -struct dso *__dsos__findnew_link_by_longname_id(struct dsos *dsos, - struct dso *dso, - const char *name, - struct dso_id *id, - bool write_locked) +static struct dso *__dsos__find_by_longname_id(struct dsos *dsos, + const char *name, + struct dso_id *id, + bool write_locked) { int low = 0, high = dsos->cnt - 1; if (!dsos->sorted) { if (!write_locked) { + struct dso *dso; + up_read(&dsos->lock); down_write(&dsos->lock); - dso = __dsos__findnew_link_by_longname_id(dsos, dso, name, id, - /*write_locked=*/true); + dso = __dsos__find_by_longname_id(dsos, name, id, + /*write_locked=*/true); up_write(&dsos->lock); down_read(&dsos->lock); return dso; @@ -166,9 +162,6 @@ struct dso *__dsos__findnew_link_by_longname_id(struct dsos *dsos, dsos->sorted = true; } - if (!name) - name = dso->long_name; - /* * Find node with the matching name */ @@ -178,31 +171,13 @@ struct dso *__dsos__findnew_link_by_longname_id(struct dsos *dsos, int rc = __dso__cmp_long_name(name, id, this); if (rc == 0) { - /* - * In case the new DSO is a duplicate of an existing - * one, print a one-time warning & put the new entry - * at the end of the list of duplicates. - */ - if (!dso || (dso == this)) - return dso__get(this); /* Find matching dso */ - /* - * The core kernel DSOs may have duplicated long name. - * In this case, the short name should be different. - * Comparing the short names to differentiate the DSOs. - */ - rc = dso__cmp_short_name(dso, this); - if (rc == 0) { - pr_err("Duplicated dso name: %s\n", name); - return NULL; - } + return dso__get(this); /* Find matching dso */ } if (rc < 0) high = mid - 1; else low = mid + 1; } - if (dso) - __dsos__add(dsos, dso); return NULL; } @@ -240,12 +215,6 @@ int dsos__add(struct dsos *dsos, struct dso *dso) return ret; } -static struct dso *__dsos__findnew_by_longname_id(struct dsos *dsos, const char *name, - struct dso_id *id, bool write_locked) -{ - return __dsos__findnew_link_by_longname_id(dsos, NULL, name, id, write_locked); -} - struct dsos__find_id_cb_args { const char *name; struct dso_id *id; @@ -279,7 +248,7 @@ static struct dso *__dsos__find_id(struct dsos *dsos, const char *name, struct d __dsos__for_each_dso(dsos, dsos__find_id_cb, &args); return args.res; } - res = __dsos__findnew_by_longname_id(dsos, name, id, write_locked); + res = __dsos__find_by_longname_id(dsos, name, id, write_locked); return res; } diff --git a/tools/perf/util/dsos.h b/tools/perf/util/dsos.h index d1497b11d64c..6c13b65648bc 100644 --- a/tools/perf/util/dsos.h +++ b/tools/perf/util/dsos.h @@ -36,12 +36,6 @@ struct dso *dsos__findnew_id(struct dsos *dsos, const char *name, struct dso_id bool dsos__read_build_ids(struct dsos *dsos, bool with_hits); -struct dso *__dsos__findnew_link_by_longname_id(struct dsos *dsos, - struct dso *dso, - const char *name, - struct dso_id *id, - bool write_locked); - size_t dsos__fprintf_buildid(struct dsos *dsos, FILE *fp, bool (skip)(struct dso *dso, int parm), int parm); size_t dsos__fprintf(struct dsos *dsos, FILE *fp); -- 2.44.0.396.g6e790dbe36-goog