Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp44987lqo; Tue, 7 May 2024 11:36:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWNThOjmAdfjtUKCadmuFjgB+qt1VJOBcwhvu4afnpJR2Iwde+bqvqx6QGOA9MCLQfq4NuVp/sfhIvpQvFOj/sSZs3JnPfdoKmEjjyFpA== X-Google-Smtp-Source: AGHT+IHBlSYlwPpDf2P3G1aMThxHv4SDaH4XdrX6DAPX/wAqX/nD8YS6eQvsF+4yMhh7f3csbXfR X-Received: by 2002:a05:622a:1650:b0:43a:f441:b3ac with SMTP id d75a77b69052e-43dbf4e70d5mr7327151cf.32.1715107009566; Tue, 07 May 2024 11:36:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715107009; cv=pass; d=google.com; s=arc-20160816; b=hzgSnpzrGBL4gEEv4O20BNbki0EDmWpBbs4iOrrTkdYg6A2kr585mQHusP3n67iNUN tqG2T2VAOf3i1dcMsVzxIxX1349QpPQSo9/URn7deHCiGwqx7SHGuLLrugjOAjnowec1 tq5bb4aDEFu+T2a65d695eRIjNVeRpEGGBA9K9aLhTOZqc1AznqvqowAtWp6pdKBHHgi pRXGB3CYvEdmDVxjz6vthotaakj2u8ZnqLCHV3RWqJJnQUga9PGh85VHKnYo7bb8A+jj QANROS3qPCw1X8HNwKfp98utys7QjehToB0fSp/JXlNZS9YGZgp41C00Xj7hgYMGG7EV RBxg== 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=GO0hb7v7nG6Id0cJK33WHU2z0Rs2/LAXioCEoSvIAik=; fh=qvhbqZlAzlgMhqVK1Q0ZNnxCfegdyJLRJV/UObNR0ac=; b=Loo7rApfp6QTiz9AnHxUd2sVdu95HBjkcIMOtVgIX6QHqxhJrzJLA2R2iZgbSiqFsL d9vXcd6IwEsBDNYEKe8X51vf0ojWAN0vjgsGhME/A0q9Ex+ouR/KlAlUOVIYCOmXP2vR wU/cmuGPl0rLj6ExjiOLpPPsELBlZXC+h0bU+s6Atxg4wMXGGE+3hXLLaa7LWtv5zrn5 9ALUbc5ptdPDOD+lZ4jONIlcD9Oa6Gog83Dw+LEO4DnV8GcryVRtG1cutA316lVCNvJw xvxlFivzixWgMOk1sA1TIBEae4RPumgnCbuNr/+zYWgZ66owxi2YbaFJ8yczKKhedhPI ImhQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=JpM5tV+P; 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-171986-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171986-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id e15-20020ac85dcf000000b0043ae7068a00si12480333qtx.27.2024.05.07.11.36.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 11:36:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-171986-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=JpM5tV+P; 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-171986-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171986-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 369641C221FB for ; Tue, 7 May 2024 18:36:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E89B916D9C2; Tue, 7 May 2024 18:36:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="JpM5tV+P" 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 8072116DEB5 for ; Tue, 7 May 2024 18:36:11 +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=1715106973; cv=none; b=Yi1SWoJSKkv4qfLzLsHUioNWDwfIvfP7yNtt72w0wxryoqq2ToWJajjrOokzITIK7WtG9cqlHcnGaWszzWh3i0ZjhwW24eY5MjtF/Hl/JB/aiK92AsuY92Kxx/zz3OaH1iVMJd6H8a1z3FVXt5FaH25S4B59AXlPe0tJMA8hO68= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715106973; c=relaxed/simple; bh=e/wJkPb6Up6/3AXzG8MatkSdBcxmtGosq5+MGZvNwTg=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=QCZlJmx2ecXee9r53FsdsqvaASJp74amBIewg+NUwtjBztWnN5cSWFPSJCnRLuMQUDPU6xkkApmTkOcCoNDlc1xcN7b8eYQdyvChBjrBcImehviZ6zIyR6ngby5YcOijzfs5E/GrWoTKzcF7R5H1gvABXWGeDHhDmZwUoC8x4Uw= 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=JpM5tV+P; 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-de603db5d6aso7220952276.2 for ; Tue, 07 May 2024 11:36:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1715106970; x=1715711770; 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=GO0hb7v7nG6Id0cJK33WHU2z0Rs2/LAXioCEoSvIAik=; b=JpM5tV+P3A+GurGJU8USFa2nRLFzOk6oI1bsorF+oNV500tuVNYYRgTsSWPecf3BoN hiMTdWPIEHeaK3WF9LoEukIcToQB7o1OulAeS2raOGiRDNUftE/02r7S7aVn66RIzKJo 0DK4e5gkW38VO1Yz05VM3TT3N6o/+ZoQqDlEmTkdPvpbOHcQ5ey8Vz7tKraflNwzcb4y UpFU1zqHyrqT8zkk0nigF+L5JDldqygvmpjRyAr9tU+duTUiqFV03IxHeg1KsegtKO5V iLj7C92CnwsYlXeUiCALI0UWWK9xoj6SB8NMcDT0yyzfoUpof+EV6+46DnQfWg5dWtr8 PeCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715106970; x=1715711770; 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=GO0hb7v7nG6Id0cJK33WHU2z0Rs2/LAXioCEoSvIAik=; b=qdv6N5AiQ5UsXFSH6ItqMuFGzg0I24wuBZLJobq5eZPArikw4a/fTe0RFO2EdzB2bF xOz9kDhJwPFW4bQvNSr471vcM4SUhPru+NmTBsWjepW2vXVLWPnsUFk0htE1XRy2Z23U M7QfaW/e1OsE6Rwuf/MqCx6Tz7rgjekMe19Uu2ouV6ZBDAcbTDz1D23GR45cPOFObAT8 RTakk7zueXoLfYL85Qxa10qFrThan/7/szYOGC8/vYe1mofF507XIqPyqknf9U0F7eT8 abfAQXmP9/FOdtbpe4ySs5Oc7Islzunh6CzZ+n2YqsjNQRNh8qvPLUlCLE1j+81NBe/2 xqQA== X-Forwarded-Encrypted: i=1; AJvYcCUbZ7K6YWFYpVGYSlU3fTmlnQeUAb8PsDwbV6FxJ0QZxyf2i8YtuWBVhhQA4oakaQXs6dWIJoWFT5MkTnr2MKaMtIDaxLNGoEpAlqEn X-Gm-Message-State: AOJu0YzlDWPB9+AYExsvSqfP2UEAHjchx57XMTZxAXsKdimGxFSJ5xIl iaEvdOVzPuKuZx9XuDmE2azot9b7mFLsGzfEv5eJ1mH4ozVAFzFEUouJnwsu87pTnhyRRXDUnW4 USgLlHw== X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:8095:fd7:9773:b1df]) (user=irogers job=sendgmr) by 2002:a05:6902:100e:b0:dd9:1db5:8348 with SMTP id 3f1490d57ef6-debb9e41975mr129612276.8.1715106970500; Tue, 07 May 2024 11:36:10 -0700 (PDT) Date: Tue, 7 May 2024 11:35:40 -0700 In-Reply-To: <20240507183545.1236093-1-irogers@google.com> Message-Id: <20240507183545.1236093-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: <20240507183545.1236093-1-irogers@google.com> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog Subject: [PATCH v1 3/8] perf block-info: Remove unused refcount 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 , Oliver Upton , James Clark , Tim Chen , Yicong Yang , K Prateek Nayak , Yanteng Si , Sun Haiyong , Kajol Jain , Ravi Bangoria , Li Dong , Paran Lee , Ben Gainey , Andi Kleen , Athira Rajeev , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Content-Type: text/plain; charset="UTF-8" block_info__get has no callers so the refcount is only ever one. As such remove the reference counting logic and turn puts to deletes. Signed-off-by: Ian Rogers --- tools/perf/util/block-info.c | 22 +++++----------------- tools/perf/util/block-info.h | 15 +-------------- tools/perf/util/hist.c | 4 ++-- 3 files changed, 8 insertions(+), 33 deletions(-) diff --git a/tools/perf/util/block-info.c b/tools/perf/util/block-info.c index 895ee8adf3b3..04068d48683f 100644 --- a/tools/perf/util/block-info.c +++ b/tools/perf/util/block-info.c @@ -43,26 +43,14 @@ static struct block_header_column { } }; -struct block_info *block_info__get(struct block_info *bi) -{ - if (bi) - refcount_inc(&bi->refcnt); - return bi; -} - -void block_info__put(struct block_info *bi) +struct block_info *block_info__new(void) { - if (bi && refcount_dec_and_test(&bi->refcnt)) - free(bi); + return zalloc(sizeof(struct block_info)); } -struct block_info *block_info__new(void) +void block_info__delete(struct block_info *bi) { - struct block_info *bi = zalloc(sizeof(*bi)); - - if (bi) - refcount_set(&bi->refcnt, 1); - return bi; + free(bi); } int64_t __block_info__cmp(struct hist_entry *left, struct hist_entry *right) @@ -148,7 +136,7 @@ int block_info__process_sym(struct hist_entry *he, struct block_hist *bh, he_block = hists__add_entry_block(&bh->block_hists, &al, bi); if (!he_block) { - block_info__put(bi); + block_info__delete(bi); return -1; } } diff --git a/tools/perf/util/block-info.h b/tools/perf/util/block-info.h index 96f53e89795e..0b9e1aad4c55 100644 --- a/tools/perf/util/block-info.h +++ b/tools/perf/util/block-info.h @@ -3,7 +3,6 @@ #define __PERF_BLOCK_H #include -#include #include "hist.h" #include "symbol.h" #include "sort.h" @@ -19,7 +18,6 @@ struct block_info { u64 total_cycles; int num; int num_aggr; - refcount_t refcnt; }; struct block_fmt { @@ -48,19 +46,8 @@ struct block_report { int nr_fmts; }; -struct block_hist; - struct block_info *block_info__new(void); -struct block_info *block_info__get(struct block_info *bi); -void block_info__put(struct block_info *bi); - -static inline void __block_info__zput(struct block_info **bi) -{ - block_info__put(*bi); - *bi = NULL; -} - -#define block_info__zput(bi) __block_info__zput(&bi) +void block_info__delete(struct block_info *bi); int64_t __block_info__cmp(struct hist_entry *left, struct hist_entry *right); diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 55ea6afcc437..b8a508cd0b14 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c @@ -631,7 +631,7 @@ static struct hist_entry *hists__findnew_entry(struct hists *hists, */ mem_info__zput(entry->mem_info); - block_info__zput(entry->block_info); + block_info__delete(entry->block_info); kvm_info__zput(entry->kvm_info); @@ -1341,7 +1341,7 @@ void hist_entry__delete(struct hist_entry *he) } if (he->block_info) - block_info__zput(he->block_info); + block_info__delete(he->block_info); if (he->kvm_info) kvm_info__zput(he->kvm_info); -- 2.45.0.rc1.225.g2a3ae87e7f-goog