Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2188228rda; Tue, 24 Oct 2023 15:32:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH77KjMZpPoFBD2G3Y/b4K67wiTVisFMh0iy8O77lOe15AGFQMOhe8B1Eps7E/db0xiIeI0 X-Received: by 2002:a05:6a20:7289:b0:15d:42d5:6cb5 with SMTP id o9-20020a056a20728900b0015d42d56cb5mr4704464pzk.28.1698186766518; Tue, 24 Oct 2023 15:32:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698186766; cv=none; d=google.com; s=arc-20160816; b=mNxjo0Pb4UpsmaSUR1RIhh4dflP7fNelhmqeH5bSTpLSXVjawlQWzRS/PHJaQGzeoa VFEx3+HDyaper7acxqbiL1DKkfFo8oe/3EJu98J0jz0YewAEBixGcpk7MqNYSqBteexz vulmPtazNEE/hrMr5y7OEwXitdXB+4byqhtMt1ceJNSk9dha73zcePkigz/5RDa/tgmV ut99saEtVGrF0a4cM/OBuzxMPEfokm5cAf3/D4fD2eDfk+u963TRnY4b9vCrcAuhOQt3 vARXORaMeUklIK3M+keDvweodgNoGlE5VglYtgJ6Fl73DPXAUu5TzxnzCuFycqGBV4YD IaIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=5sjI1f5vh005/1ecdkhswjpcyMDjRf+co04ydutakFc=; fh=NAro5oTsDEB2Or99ABwb774QJkwQSkr6EoLVqn/Yde0=; b=X98sUs/6Lk83f5Q5fXwOpWHX9OgTdMWuGJWfZxrmRWomDO542+YIVbU40QArCrfje6 eJDAW8uvpWAjbM/tsuoMGNomE7mf9c4xCn25ZlHi8gLLM0WTcDpleM1mwc/ozgdCvkeJ pgCrDb+oJheyuDiHbNfIM0DWgJ25S5bKPod3ce/iJkpb4BhqVEeLlIaMtFwJ3uGnmS8r NbgAyFrRyz0tMuTxCqNWGMESKA2CsWIBZec+b16ZEiqfoOk50xNq8x017gYSp3V1+tII iQ5HJDYwNWKEIqJq/TgcSDE8+ZhG0+pvCYAiDBkh+ICLCeoCDkFt0C/bkJ0SwrC1yJ8o 5IKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="T8zHFj/O"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id g4-20020a056a0023c400b0068e3efffe2csi9302372pfc.243.2023.10.24.15.32.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 15:32:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="T8zHFj/O"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id DE450802A929; Tue, 24 Oct 2023 15:32:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344537AbjJXWcg (ORCPT + 99 others); Tue, 24 Oct 2023 18:32:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344515AbjJXWce (ORCPT ); Tue, 24 Oct 2023 18:32:34 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B9A82106 for ; Tue, 24 Oct 2023 15:32:09 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-da05c625cb9so771924276.2 for ; Tue, 24 Oct 2023 15:32:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698186728; x=1698791528; 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=5sjI1f5vh005/1ecdkhswjpcyMDjRf+co04ydutakFc=; b=T8zHFj/OHVjxmE05D5BJ81aNeynwMc6CaVRPxPYfjq3TZLWjCO/t2e4VRGeiijxxHr Fl6dmf5od/bGTyYZoI2YpgJCdESo007yg573epmyX48R2DVZSjLA+zv/YkzQDLTaS7fg L7UKpvvzBsZ/4IpS1hTf9wno/5EzN7N0jvmsg3YAyT2NGaAwKwdbZVRza4jSz/nBjlYe KS6X98rkNrMJNGhmjI6lZs8t4r1B21miEBxXTrhIEqURKzPkDKmFhpgsIeGNZKis1U09 zUnqnAVTSmP3F1P3IXHpn0sLXJA8LDcEdrSBWDlK0dwEUg80g/Y7xKEwXbpZEmTTkpbz tx/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698186728; x=1698791528; 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=5sjI1f5vh005/1ecdkhswjpcyMDjRf+co04ydutakFc=; b=P3RvO6LWsY7iMEmkRsKpMFt2YxElEGaisvDm7sP7vXr+BqZVxmqd2s4ET61NPNDT8q Q2ZPI5qKTFc2cEJgNvC6DMuNwUKyaCQYMyWL55hk9y8O0ZfI8WEfocysd3BjQo9AJt11 DcyQPXzcgBZf2yrF6MiBhLe8GBijP47aDwbYsVDnyKiPvpWeMXW50EQ7JzB0KyIgdpNv ciXUO2xbGf97a6ZcIoL3pERHptzcH4Q08OjIyM9xAcbiF7xCHd1Iqnp4CTT+RLbwJx2q bCyOpCfJxofchnc6G+jDc+QuCZ+XOSNVBQGFYrbtEd2U2AuAJyou+jMdgpHH28+z21Rp xcOA== X-Gm-Message-State: AOJu0Yy0OzGu0hMGlJu2GQ5u1az7vtTTQqv4KZYLS+UyoqnRt2m53pXy qKsVOZKl1s0FMgB0P0Kzh97EmCQVqu6X X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:93d2:18cc:4d63:45ba]) (user=irogers job=sendgmr) by 2002:a05:6902:181e:b0:da0:622b:553b with SMTP id cf30-20020a056902181e00b00da0622b553bmr29800ybb.12.1698186365779; Tue, 24 Oct 2023 15:26:05 -0700 (PDT) Date: Tue, 24 Oct 2023 15:23:53 -0700 In-Reply-To: <20231024222353.3024098-1-irogers@google.com> Message-Id: <20231024222353.3024098-51-irogers@google.com> Mime-Version: 1.0 References: <20231024222353.3024098-1-irogers@google.com> X-Mailer: git-send-email 2.42.0.758.gaed0368e0e-goog Subject: [PATCH v3 50/50] 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 , Leo Yan , Song Liu , Sandipan Das , James Clark , Anshuman Khandual , Miguel Ojeda , Liam Howlett , Yang Jihong , Athira Rajeev , Kajol Jain , K Prateek Nayak , Sean Christopherson , Yanteng Si , Ravi Bangoria , German Gomez , Changbin Du , Paolo Bonzini , Masami Hiramatsu , liuwenyu , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 24 Oct 2023 15:32:44 -0700 (PDT) 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.42.0.758.gaed0368e0e-goog