Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1556479lqa; Mon, 29 Apr 2024 11:47:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVj6LiDOQKQ7oTAAywwoDuUnNDlMMoCYUncsEGgVXx3/q7D1c2oZaXd7FIsVodWiMi0UydWd0K1B764/bwPd94PLW7uTcIxo8WiPIU4Gg== X-Google-Smtp-Source: AGHT+IEJXAUSAvsD83SVAuS++buboUH3pGD8AUKpBe7yXp6Y2L0FjXISNuNcAqz8Sd8Ih/XgP2RV X-Received: by 2002:a17:906:2303:b0:a55:6355:9e1a with SMTP id l3-20020a170906230300b00a5563559e1amr5358929eja.1.1714416443576; Mon, 29 Apr 2024 11:47:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714416443; cv=pass; d=google.com; s=arc-20160816; b=DSUhULb1mQGzX6EiKuL+cLs2uXqwKlkynpPvRwXetnrg1qz7AlQXn81wNlFTeLn5Aa B6lHsA//VnnOReO+ikiLSzxHXnYaUgKSdUn3IbgFOlT6i+EQcPM2CCf6rTwcINHIfxzG kdGs9MmAxu5/IubppnnM4KCPuax6ZGYG/sHyIeuNuEX3mgk+S763xH2ML9XHYiWAM9EU TplNjmIioF4+Amggnt/LgFWdHwWoXy/bQdKWoWzOrIYdy8n4hSXBDanSDZgDEBplFxR9 JV4XQszgQ/8WHMt3kDKKJU9bq45lf5jk92symH/SbSs7z02iBgz9Kb/MW5OrZcNVqeZw dD/Q== 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=YaakWA+9pmWCC2IKulyCPlxCN4FZjrOrV99o6doTC0Y=; fh=LSBmxpVWAe7E4SgHkgHK4F3nlpRYs3Dmb3oBR9tuYUI=; b=LQnNTGR2vl18sKRJVNEoREO4W/8CymCy+5XfsPaeI6lyuvMeU8EXxNBnCOpXXtYR83 A5e1f64cdBadsNLgSJGI5Ni6EVUf+V9Ynozw7ql00ikVv5tLBKrlyjIK2jU5urTtaaVi Kf807t81xZun86eRZUZlqZ8QjNVUMhb0JvRFTZCM/yiN9WEB7lnEUQftRhju9+mAI5Do Fe36bcGRqOGIzZGJVmqL0kjiDzECBXf1vTU4hYEn3QdJLqBnfeOE8UYWJeksoJ0jGFrD 0LVhZp1a6gJ8sDm/4Xd2r/o7U84kjR3n9GhXZZ7mm6MGPPQZvoD2jmfpwjBRVaavr54G eRAg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=KOiVY9Xs; 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-162850-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162850-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. [147.75.80.249]) by mx.google.com with ESMTPS id a17-20020a1709066d5100b00a58ed275918si2677095ejt.787.2024.04.29.11.47.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 11:47:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162850-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=KOiVY9Xs; 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-162850-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162850-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 DF67A1F225A9 for ; Mon, 29 Apr 2024 18:47:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 633F013BC3C; Mon, 29 Apr 2024 18:46:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="KOiVY9Xs" 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 CCB2D13AA20 for ; Mon, 29 Apr 2024 18:46:32 +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=1714416394; cv=none; b=VQy+WqGzLVsBasEuQXdX6hSGQisLZWaWZ2OwqSJFVfD1Sh7PbaSKWopFaW/HUznDpu6YcV//6eZDwiPkB5tn//Dh517NvI5e+6UZhR/390FTdNfOAVgs059701xgeZYLwqS0pIcV222oR7KfZzZjbHE6105VJdp0JEiahIMBqFE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714416394; c=relaxed/simple; bh=7wUIMCnoFq7ZLkHWL+493f8aFpVbZ9Nfs5gexZ7yT5c=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=o24RRIUOPreEjJ/Y/Y6WOYyf6y61dEoaFQc3TNxqfudN3auCTCxcaeK4Q9qdW017cWXGmP10276Ff8tFmNLnzWp9yXiWZ5+/KTyF8W3YRt7ictM0AZ/gyemLpFgElIhrxXW0E7Ow57S9mjIOsDgPGqdx+to7SCx3VSV8VLzUyqk= 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=KOiVY9Xs; 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-de5520c25f0so8999858276.0 for ; Mon, 29 Apr 2024 11:46:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1714416392; x=1715021192; 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=YaakWA+9pmWCC2IKulyCPlxCN4FZjrOrV99o6doTC0Y=; b=KOiVY9XsmB1Z2qIS/z8S63njWEN17S3f1RqfV4W9WhiraE4E6JMkDPVFcEy3M+rC5M qyEzgZrDKzvwienI2Jk9wZxmQ8UwfdDkGLHVjeOsU0Hl27gC4VmynAPhapoprLWbxgSo yS8ih3Gqsl41WEWHwgmRgrg+VAuvzJ+zIr+6/KGmBmqQXZg/r29WIfN5qs1sLlqcDT1b QAhLXZm8IbSnxlVUBSUS10PeVgXcp6c5kxeJnG56wdEJpIdThfCbe++yMvQQevgLHzjI unPPR4kt4M84uModuihMNCXtMdOOYQnuE6WAdHLBK7O3ObFlqGzpo7KlYWpYOzjYAVKh KVAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714416392; x=1715021192; 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=YaakWA+9pmWCC2IKulyCPlxCN4FZjrOrV99o6doTC0Y=; b=DmunyhIIQMr83HUBvd9iwOn2O20e8TTbtpMfx+L1Q5dUOIKc8ARKrSZh55kn+1eUoa Rta7bbxCN7axH/QEmIEL7TIMGK3l3XXnhWpbbR7SdcNuxZh+S2AiQfEqTJDvjjQ8DVjY W1/FHPW3iUGPWeFxIUbyOpZpwD544hrUL4LoH+h5v1a9E/Oa6QmolPAzaMwchbnAlZ2N Ctn+rZwt4SY4v/50FXSPvqpCeh6vAFR7aycs3FACaqVhDNQrGEZ1yK9VV6Yebon70Laa R+r6oqc1CTc0O69y+qe/OzeW/CwUVYeic46SKOaQkoTMM8m0FFqjcPRYYEnXv/O2ZFbq QRcw== X-Forwarded-Encrypted: i=1; AJvYcCUpRkRBuoPkl41h6OOG9GZsU6yxlfUKmfksZvS+Kpb8WR0boP2W/pRobS8CSJOAGzFNrVQmzXzC9AAUT7RW6rKn0sK8JQivuSvur3WP X-Gm-Message-State: AOJu0Yw0QsUgVT7OB0QHgEcvqGB9DWoe3vwERc6LEd9+6I9VFvDbrChd v9USxf2jHsysjXeHgKkifBSjJAQfmgBYVywm0WG2R9aujXyj1bukZuI4Up8o0TUH3IbuK8WpClr sXnhXGg== X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:c137:aa10:25e1:8f1e]) (user=irogers job=sendgmr) by 2002:a05:6902:70d:b0:de6:bf2:b026 with SMTP id k13-20020a056902070d00b00de60bf2b026mr123539ybt.13.1714416391739; Mon, 29 Apr 2024 11:46:31 -0700 (PDT) Date: Mon, 29 Apr 2024 11:46:10 -0700 In-Reply-To: <20240429184614.1224041-1-irogers@google.com> Message-Id: <20240429184614.1224041-4-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240429184614.1224041-1-irogers@google.com> X-Mailer: git-send-email 2.44.0.769.g3c40516874-goog Subject: [PATCH v5 3/7] 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 , Kan Liang , James Clark , Athira Rajeev , Colin Ian King , nabijaczleweli@nabijaczleweli.xyz, Leo Yan , Song Liu , Ilkka Koskinen , Ben Gainey , K Prateek Nayak , Yanteng Si , Sun Haiyong , Changbin Du , Andi Kleen , Thomas Richter , Masami Hiramatsu , Dima Kogan , zhaimingbing , Paran Lee , Li Dong , Tiezhu Yang , Yang Jihong , Chengen Du , linux-perf-users@vger.kernel.org, linux-kernel@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.769.g3c40516874-goog