From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.71 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794606587; b=GOjWqaWZH7XFgqhQvxzEVebIU2kTfEFLgnF7PREFMTLo8UE1rTrymUtwOoI06J16hnBC VqGbFeLXklepMsznZe864Cmf+d3tr855SC9BeRLQOHK4IBp5iinZcd4mmsA0Uinqy0e9P 8vXhwSePjLXaLjdY47QPRjIpl0xCCJ0Ika9GRvoila/YZSfOUrDEz5jSiVviWU4rUdKDU fvqG4FIQ/x6HVP6Bv8qBGoz9OLrCIidas3CY1jkuMv398rx6HegnfQoV73yP2MDRk52zz OSM93ZZgdtl6cQFrjJB1xxYQPxTJfNKVWGkDHeU53bnrzYaeDh6BsFhuKHK0JInGXlg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794606587; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:Date:In-Reply-To: Mime-Version:References:X-Mailer:Message-ID:Subject:From:To:Cc: Content-Type; bh=/5i2ltmcVjosixSLC0kU1KPhviHORkG8iQt75o4rO0U=; b=QvjGDz9/sMNtRRCOlf96LGiYfUk1jGHSn8p7F1dCbQS67n45hqQevdFZNaQKtEjEdcan 5xls9j4HIAqnrrj+ZZZyyQfxkpE9VN2uMhbtcltB9Ws5dzOTdQX7gd+sznZhBP3lU2ob+ 3AJPIE2w/L6rr9zLwczzfa7XyU4dihSj4SjC03TzwnE2ahYUC1/XDc5bvERoOlR0MzUjd grxQHRWIBwZZFfdGGruU+GCmP2l8MSfTKRcgqJbP6ASx79qkKfCNrRv5WPkufrfwwmShe hf3yYM3JHWL3V9rV8Vzz94lT+2Ns7jsL+zrSOqR7lBKwpkaiSqYi/FsAzh8IQXOUoPA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=MBlPc1zr; arc=none smtp.remote-ip=74.125.82.71 Received: from mail-dl1-f71.google.com (mail-dl1-f71.google.com [74.125.82.71]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 039CE60A5BE6 for ; Fri, 13 Nov 2026 21:49:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 039CE60A5BE6 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=MBlPc1zr Received: by mail-dl1-f71.google.com with SMTP id a92af1059eb24-1aa0fb7f157so1777322c88.0 for ; Fri, 13 Nov 2026 13:49:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1794606586; x=1795211386; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=/5i2ltmcVjosixSLC0kU1KPhviHORkG8iQt75o4rO0U=; b=MBlPc1zrwkRjh7Y1AmIhDatbV2d2NnTborje78Iidkgq8T7qaYKbL6Nlf8/u/EllM+ YmEEaP5f2Z76kGj7j0NhgdFIG5HpEVSdI7jFEnB9V+MjZjRnmKCNW4Qu3sUym75tYV95 iR0gC6ifL908gbUWxyNPMxsEr9F1zonkTtbkJX6DwNMJHOKUqgoK4XwgwdvRZzS3eS+k YswtdthOjtn9uU9txRBTn1JJiLzjDEBWqAclnaUVBKKq6Jq5rY8yJ1XxsilkOlE7i9Pr 7YWqsPh80YtYdesAypcakQAnwUNwpTXwxdl65I99O8eStpT+FhRDQbMtlHmwYSkKfw4f Hw/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794606586; x=1795211386; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=/5i2ltmcVjosixSLC0kU1KPhviHORkG8iQt75o4rO0U=; b=EOGYLXkYwO3NV2vZOf8Wq0X4LyZwUtL0sp5cCFrgAZlS14VA9c2oXnXFfOnWZZ7H3V Dkt0in427xxrn8ofveS4dSfU9CmXbKG2NCllbB+brF6N4pDs1tppMaLwVErYVqTjAuZs PUXTt66wTxH261YhRsDokQIg7UB285HrkF0NxYPENUmCuvXgYs+R6KC0QnX85hRO14tq FRL/KhpOr/4/NaJDi1e/O7oa2CRcVh0lRe/uO0QhvQXP9N2c9ShkxfqKKVcrlW9UyMGj YMWljF2s/6Bhd+lnz7PLl+pbON2R9e5i2ghUy0y6zBORhaIJtwVdGJRFvwgd1Ol2NkUC K8kg== X-Forwarded-Encrypted: i=1; AL+hErEgyN8Nt9vOJLEhMiZtCFkfSywGbxUvWUJytkwi8gw2wYtMOigXJfJG00YBMNqqYI2UksohSAIxBF+woGM=@vger.kernel.org X-Gm-Message-State: APuU4Z80MkSDBsv15EVWuFazUW5pZP0+U+ctYLXi+pred/gzMI1QzLsy WJgqGV3/B43k1c5YEj/dgnPJxt4cTDu7wrMmBFgHbTcVKojMXYTyu3ihzXB/Cr8JVmn+ZSD/Emk Qv82g3G/AAA== X-Received: from dlbqq3.prod.google.com ([2002:a05:7022:ed03:b0:1a7:450c:8b47]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:5f0a:b0:144:c123:4036 with SMTP id a92af1059eb24-1b5030ecdd6mr3164387c88.35.1794606585841; Fri, 13 Nov 2026 13:49:45 -0800 (PST) Date: Fri, 13 Nov 2026 13:48:37 -0800 In-Reply-To: <20261113214850.3329699-1-irogers@google.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 References: <20261113214850.3329699-1-irogers@google.com> X-Mailer: git-send-email 2.56.1.703.gf848ed807c-goog Message-ID: <20261113214850.3329699-14-irogers@google.com> Subject: [PATCH v1 13/26] perf lock: Use generic hashmap for slab_hash From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim Cc: Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Convert slab_hash in util/bpf_lock_contention.c to DECLARE_HASHMAP(slab_cache_map, u32, struct slab_cache_data *) and use hashmap__for_each() during cleanup. Signed-off-by: Ian Rogers --- tools/perf/util/bpf_lock_contention.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/perf/util/bpf_lock_contention.c b/tools/perf/util/bpf_lock_contention.c index c20bd075664e..2bd8e62d3265 100644 --- a/tools/perf/util/bpf_lock_contention.c +++ b/tools/perf/util/bpf_lock_contention.c @@ -20,9 +20,11 @@ #include "bpf_skel/lock_contention.skel.h" #include "bpf_skel/lock_data.h" +DECLARE_HASHMAP(slab_cache_map, u32, struct slab_cache_data *); + static struct lock_contention_bpf *skel; static bool has_slab_iter; -static struct hashmap slab_hash; +static struct slab_cache_map slab_hash; static size_t slab_cache_hash(long key, void *ctx __maybe_unused) { @@ -99,11 +101,11 @@ static void run_slab_cache_iter(void) static void exit_slab_cache_iter(void) { - struct hashmap_entry *cur; - unsigned bkt; + u32 id; + struct slab_cache_data *val; - hashmap__for_each_entry(&slab_hash, cur, bkt) - free(cur->pvalue); + hashmap__for_each(&slab_hash, id, val) + free(val); hashmap__clear(&slab_hash); } -- 2.56.1.703.gf848ed807c-goog