Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp646360rdb; Thu, 1 Feb 2024 22:19:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IFEYmqWctYaz81hirEIUnpkh7AQIVlG8kioqDe0PX1I+o3sRPzk22q7D2JZngs3UYuu3ymp X-Received: by 2002:a05:622a:1341:b0:42b:ed14:eaf7 with SMTP id w1-20020a05622a134100b0042bed14eaf7mr6218987qtk.7.1706854745672; Thu, 01 Feb 2024 22:19:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706854745; cv=pass; d=google.com; s=arc-20160816; b=yQgtBTHn6Ez/1hrtzzoizlOqmbNJc86V2cV8yBd/BNMbPY5mwqYEw3iFDd+aCvJpIU o/lDo1GPP+qyUUVALx1Cf2nr5Ylnf8oXMPLtSNHNfCt11orR6pdh06mMc165n3jkqoZn jqIXXkkGeCXaXuc+Rk/FEC4ZI1uchJCa/afxr3vLb/dY0kRBM5C8gbEZOH4OB0bU7wpP 2MQoZv7rYFjSDu3oo2K0xjooO1xTpDAzsEG99YhLv+A4ZIyCPy9Ll7ao6ukw/mq3uAqG b+/XtGyiM+Gq5QigwlBujtHOZ+39Ck/MaK1qm70y6A0+6Ee/G9y7QgiOsJgXrB8Aec5n NM9w== 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=Rt20z4T5VPT3LRcytD9SJzsjA7tToX3uHX4SxOAPIZ4=; fh=sTWv2yXYxlbROc1s2b2qCoyxZx4mHZG4ShSTwCWpmEs=; b=cju5So5DCGnBWgS8SSfS9Z0i+vOrVX5e165/VDnEXC+OUMDDSGQxn6BWL3FbiWWpTM NLIoh/Csi2CEAl3roMBYH/fFipSsm48NufCE4rmR3vo8t9SyNHzK6OnmIVhQAG88KVSq EBvd0yd1Q5MzmwUK4oCG5DEfkGF9RAWTg4VLM75VZKaV9+Nt6enF9ZrNAGbtUhdEq1wO OQh1AbKWQBf/CiGwlOAru7u8Fsqns1fDVicKUUf+RP9GOXYf+Cts8xUej9R0A5b+KnRz Z07loymY1sxI397PPBLeCiCv4Iztmv0TNbn7VCxRx0Ye/5Nj8HPebXztJpmGYLsqmm74 82rg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=gtwdmomx; 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-49252-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49252-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=1; AJvYcCUD8rbxbZSCWRptzbAzO2UHu6CDH29OY0iZX8WPKh2m5RoYc6zD8A6kHZ6O7zUTEFZL1oeGT2VPL3dau/5bBe2KwcU1JngTm2+iZAgl5w== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id b20-20020ac85bd4000000b0042be30ac310si1357161qtb.539.2024.02.01.22.19.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 22:19:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49252-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=gtwdmomx; 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-49252-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49252-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 6B6F31C24533 for ; Fri, 2 Feb 2024 06:19:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6F9A3282F7; Fri, 2 Feb 2024 06:16:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="gtwdmomx" 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 7C8751AAD2 for ; Fri, 2 Feb 2024 06:16:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706854579; cv=none; b=YXTAm53w5C2bsBCLZ4aT1uZrQGHEvLqF1tJAk7RyWpzKwSwXZCpiR0TxBm8lumgiSzcSjMo3V5xa8CNjYQ3M2HuCFnMubxrWUjVVjqZXNNFXsShzahoFQY6EdDuZNPC62Y/ZkTY8MlDytuDBX0y2OFu3Iz/+5Zfn5ktuL0d13qw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706854579; c=relaxed/simple; bh=x/5fHTR183S/2RfEcYCstWfa0bGQ3QCOM8/PnsO9ubE=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=be9JDWWSnZflCjqxCiX9QnQv0pLyY7cmyrDiT53HjYLH6SJpyQANF5pIesHAXBAYpb4qawNYVc61b5GjAvx4lpLfqv/tNhrgEsBPRVMpDf6PaqTyyypGgKZ0OAECzvMRwRC545Q+akXMVogNO3h3HAjKn5ClPIT4JmpbuLHVzm0= 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=gtwdmomx; arc=none smtp.client-ip=209.85.128.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-yw1-f201.google.com with SMTP id 00721157ae682-6041dbb7a78so25540717b3.0 for ; Thu, 01 Feb 2024 22:16:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706854576; x=1707459376; 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=Rt20z4T5VPT3LRcytD9SJzsjA7tToX3uHX4SxOAPIZ4=; b=gtwdmomx2Cp+Mp32uFL94bep/cCR2gYlgs/3O7l6drunD0zB5E+ROXF0LAJg4mS7td V9c1sye0U63OOIwjoCg66JjJRdDIjyPXQhYVe4to8pYXthL4/fNelEVEUny1BOeaEBHz GkVvGREGlPESkavGdja3hKtySNT4g1Qk8bb1UlvO2r+nHOc5sCJd/8n8gVLULZMXBr3y inXC6NNB0s7nNUBUC6gBIV2aruABwj9vrdgmpOEH9ZZmeCsBiwd2PUyb8A7g9rE1nZ8m +xqFUYScUgWJpOCs2vZX9yctlGhVsb262klCmEGP59BtKoYS/tbl6kOM2t3lwCmlymnk 3RvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706854576; x=1707459376; 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=Rt20z4T5VPT3LRcytD9SJzsjA7tToX3uHX4SxOAPIZ4=; b=KEcRDAanDMbrVtuXsDXqayJxb02PwsfrEIc+ABqBTil9XDaK9vHnC/Z8VJxYT+kPh0 2xPRRv8qFeQTD9SxrFcQoGXfq1RpgzLuuLL1118C3qEBTSTjs/seCl7KUpoR9wrJcdBu r2b7ey5hpy4jpDPZXrktXlCXKm/E/Mm1joL8PtdkWSF9xSIeYgqkd6dqEviIpS1N2lYg T9WoUVnPlQo99N7HgPJk+tLEaUgX7VBhK00Hoc3LFEob35itanImbnJN61TKdN0bocvT CM5dJgeWdCtdkYR2jvPN8+zWA2yEL87LpljfR6F4x9/04HenDjI/hJ2FV59W+CBriTdo TQiA== X-Gm-Message-State: AOJu0YyxUvd18hhmxSQji3/1/J9Ww3yNrSv591VfGVED4hJuZB3HKy+C u01Y7V1+t2hZ4pLy6JhmmdKG7UmSXq74wncsJYLk0iAaqVaeTe9qcF4JkvJm12hoHyYfyNxz/+Y D7i06hw== X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:a85f:db1d:a66b:7f53]) (user=irogers job=sendgmr) by 2002:a81:9b4d:0:b0:604:5ca:5ab2 with SMTP id s74-20020a819b4d000000b0060405ca5ab2mr1614230ywg.9.1706854576529; Thu, 01 Feb 2024 22:16:16 -0800 (PST) Date: Thu, 1 Feb 2024 22:15:20 -0800 In-Reply-To: <20240202061532.1939474-1-irogers@google.com> Message-Id: <20240202061532.1939474-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: <20240202061532.1939474-1-irogers@google.com> X-Mailer: git-send-email 2.43.0.594.gd9cf4e227d-goog Subject: [PATCH v8 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 , "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 , 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.594.gd9cf4e227d-goog