Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp6935933rdb; Tue, 2 Jan 2024 21:10:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IEMix3ZWSqZz2M/fjQbmKa8lgiW043+zT6JjtEsAj9dAP/+nc+4cuZ7319rpyepbx3x9xv+ X-Received: by 2002:a05:6a00:bd4:b0:6d9:8f4f:5526 with SMTP id x20-20020a056a000bd400b006d98f4f5526mr7560272pfu.36.1704258652987; Tue, 02 Jan 2024 21:10:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704258652; cv=none; d=google.com; s=arc-20160816; b=gE0RnKZlrG8YC0uliJxb3HM/wPYorqRJtSKfNKP7PzxVL30J7AkkuvFoTKqVwEYNFO OHEymgRgnHbE6Pn4UMaMRxLHmXHMBAdL6oIbX13wf5tiibG8tsEby+D12/11fr1f2jIK 6K6U/g6Ts/oJ77PJjjCLYtBWfQuosodoZtTtXLToNwRET8SusvUWAzywGXoArCxmNH1c 71lti7lsK105v2pOHTdSKd4HqznTz0W4kbj5KPlxHlsXbOfxp+AqMPZFSvSbPwVRzwpu 4A+PgkiacKhJGu/GvNca4sL2YKpyZ45MWY1E8HOOsCdcD5pDtZcBcWntLiGdAKDsnnz+ temQ== ARC-Message-Signature: i=1; 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=MbllDlnO3rG864Ljl3o3amAjh6guujvESwDRIjsIsd0=; fh=Io7x3OacpefNRRNKoYAzVE0aWTDwD7FRzyCdD1e3AN4=; b=W0bZFJLYt+ecE9t6EIidTqLYXY9c0PXq/OqrVTq5+rBAx729mpf9erUqQYEdbVcqFj TSRRSeB9Jc5A8uYa+nm5s/q3iTvpQc/TVc7jddvfbx/BCo2Zsl9Y6okX6ZROUBi5BWrG UM8sxFcWDiSV4lajMEFEWxTgMYWluHiEgPGv+sh/UMwAzlN888Y4PVamQqBh+xxb1Qhv 59MxMlhv2o+vWzJiUTP6ynDdTKH46cX/sEprfbx0EsT5zG7cPQEskCzN7ybJyswhlFQ3 zuURs/DMK7ayxXL10q2tM99JRbP5Y9HRt2/arrsFw65j0d96KXCYUmD68OQYAQvr8S9k PilA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=PdJHL6FX; spf=pass (google.com: domain of linux-kernel+bounces-15172-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15172-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id w20-20020aa78594000000b006d9aa425766si17038830pfn.103.2024.01.02.21.10.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 21:10:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15172-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=PdJHL6FX; spf=pass (google.com: domain of linux-kernel+bounces-15172-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15172-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 9F1532827E9 for ; Wed, 3 Jan 2024 05:10:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8FF6F1944F; Wed, 3 Jan 2024 05:07:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="PdJHL6FX" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.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 929E118EC5 for ; Wed, 3 Jan 2024 05:07:17 +0000 (UTC) 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-yw1-f201.google.com with SMTP id 00721157ae682-5eef1c0fdadso53624407b3.1 for ; Tue, 02 Jan 2024 21:07:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1704258436; x=1704863236; 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=MbllDlnO3rG864Ljl3o3amAjh6guujvESwDRIjsIsd0=; b=PdJHL6FXm9mUjvkU+Rp+FGxsujYDKgrYBGnb7rHmF75miV3ClNxoXGCjUUFOBfcLYW zvD+e49q7l9tjPUrm+/bzK41mZmZPQ0E6LY7qiAjV80ALvmtmi0FoKwRcJI/q26Rjl50 OdSuXc5xNvFbJ8SDMZhvVmNfjibNKRqm5M4dJOlsBqrGfbwt+tYevxhN/Nuj3dfcEx5U 75/yiy+2vs5tpcB+D4Y10p9+37dKpjCDuTvJRr+xWMa+Vv3/W9M57T9fouTcmKgZPps5 M2acrH6IGaAsC5caFVKOjckgXOikoP04cBffQIPMQDTJnUMr6sYHLvJgY4nKAMxR2ls4 wpmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704258436; x=1704863236; 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=MbllDlnO3rG864Ljl3o3amAjh6guujvESwDRIjsIsd0=; b=mi8SEuQRQ3AkxpUFIq9xqM+P4pYSA22LunR0Bd5lYwLmqBjDJEQDMSb9LUXPhkyiEx bdQcI8yvtPj0eagVk3kodJotHH5Z7cCe+udHJ+rLGLxHnBDmayxhk1wU7RMIi1G5TXAD f/oA33LuB4IrN0Be8cIYlMcRNMK+X31ByUU+s+b6FCRWodV8Yz9NGvmoOhDCne1Y93NT mMck0SQdLvvFq7dD0og3zzbfYYo1WEboJ+GgbI6xj1sxAJC8cwQIw+LG3BGYzAtt2xlT X3HGt2mfYG8xoZdT/TDgguP/MwP5h1Jl/8Z1JknBi8pdvOnHQcthsrHOZcPjR9q2KK0x BhUQ== X-Gm-Message-State: AOJu0YwfWyUb+qCF875fmhpAlHKz61SMFMLNNqn2cA5krAWVmW4BrRic 4SKTaEN98DYweCzQURnsHGb55ukm7M6BYUsTR/8= X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:e2bd:f1f6:8ea6:8d6c]) (user=irogers job=sendgmr) by 2002:a05:690c:a9d:b0:5e8:f747:1cb3 with SMTP id ci29-20020a05690c0a9d00b005e8f7471cb3mr6769721ywb.1.1704258436667; Tue, 02 Jan 2024 21:07:16 -0800 (PST) Date: Tue, 2 Jan 2024 21:06:23 -0800 In-Reply-To: <20240103050635.391888-1-irogers@google.com> Message-Id: <20240103050635.391888-14-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240103050635.391888-1-irogers@google.com> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog Subject: [PATCH v7 13/25] perf threads: Reduce table size from 256 to 8 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 Content-Type: text/plain; charset="UTF-8" The threads data structure is an array of hashmaps, previously rbtrees. The two levels allows for a fixed outer array where access is guarded by rw_semaphores. Commit 91e467bc568f ("perf machine: Use hashtable for machine threads") sized the outer table at 256 entries to avoid future scalability problems, however, this means the threads struct is sized at 30,720 bytes. As the hashmaps allow O(1) access for the common find/insert/remove operations, lower the number of entries to 8. This reduces the size overhead to 960 bytes. Signed-off-by: Ian Rogers --- tools/perf/util/threads.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/threads.h b/tools/perf/util/threads.h index d03bd91a7769..da68d2223f18 100644 --- a/tools/perf/util/threads.h +++ b/tools/perf/util/threads.h @@ -7,7 +7,7 @@ struct thread; -#define THREADS__TABLE_BITS 8 +#define THREADS__TABLE_BITS 3 #define THREADS__TABLE_SIZE (1 << THREADS__TABLE_BITS) struct threads_table_entry { -- 2.43.0.472.g3155946c3a-goog