Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3429650rdh; Mon, 27 Nov 2023 14:14:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IHek4lNVUhx3bvwQfB9NUTj6W2v7eHWnpIb256rEvxwY6dJwsa8oLeQVqpeLj7oOWkuwS83 X-Received: by 2002:a17:902:b601:b0:1cc:688e:5b1e with SMTP id b1-20020a170902b60100b001cc688e5b1emr14536399pls.67.1701123278393; Mon, 27 Nov 2023 14:14:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701123278; cv=none; d=google.com; s=arc-20160816; b=gV7FtNbfYxnRRFTd7/MKGU18sPvBHht4ff64ylmxQMQvjFbwtIuAp0CYLI50rk6/Ar dlAd3TCqsRMTrqrPkX0qFDPhy+qRj4LK6GYtE/93xu5G7k55MInEJWBk2Mqok51pzopO 918n+diThLK0aWQ3VTBm2dVpR475doJ3GbysjN/MSddWK14FJlNTIs7u9ToiWgQOhPg0 oAEcHC+ELRZD3Obv+J/gvlnuYTlOAGUZRaGSvtZlWNL6k/olamIRezjMVosEWqjZGWhe fdokJrx0qCmeTtBiKr8wZ/lgBLjYidAukx2Pav406yMIYNewTnbYhAB9LwRYWeMDt566 JepA== 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=8HtKu9iAXaV88hgxFxNvjjL2GaCw51rWrgIl23jSopU=; fh=Io7x3OacpefNRRNKoYAzVE0aWTDwD7FRzyCdD1e3AN4=; b=ZmSJx5O/B0f4uNx8nHshFc79OCgUjUohvj3mW4BTMPu0MBF/BPsqamzS9gwclea2fr uFdduCwIvhe9gzY9ADY0+CbD+scvUHAKnahqeIGxIN0ZVbBsvtzA9t6xAHPzncpLu/Sh kalnC/Et/BoJ9fbPeMg5WhunegzpBPyxwIRJPS6mR+Ot7pCyS//8zNKf1BTB++kqlPnt 66zDGTyWjQr3+0kRxZCLmHkGjdquPxUcEJURcs5rI/dNEYVSOCtqRwjUuW1r/s7VVhn7 PlqKe54TGD47fCsfltbsYV+OUSdVFJeXB66nR9gLckq+z1sQv9bPBzhg7VwzeUDLTm89 JxEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=kaZt8UKp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id c5-20020a170903234500b001cf68d1040bsi1285728plh.402.2023.11.27.14.14.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 14:14:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=kaZt8UKp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id 2B0D3805A78D; Mon, 27 Nov 2023 14:14:34 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234309AbjK0WOK (ORCPT + 99 others); Mon, 27 Nov 2023 17:14:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234337AbjK0WNc (ORCPT ); Mon, 27 Nov 2023 17:13:32 -0500 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 BE0383252 for ; Mon, 27 Nov 2023 14:10:49 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-db4038d7cfdso4283357276.2 for ; Mon, 27 Nov 2023 14:10:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701123049; x=1701727849; 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=8HtKu9iAXaV88hgxFxNvjjL2GaCw51rWrgIl23jSopU=; b=kaZt8UKpJh8eSa03SjPg8YmVvsB61n0XkjbapUWvBpD5C5NehTXQUD2lfWbM1WfJQm 3J6Enc9mEDc2dOod8XtnnHI6OzLp0CUCEUUVUDfpkNrS39IGn8xDnZGH145aC29ADKks AOErk65kPODlI8xsclcrUfwooRWcBgYRxSSgnAtYDlRihaoGSIszG8l1r8uM4fOiNtP9 +VdjOuukGeEo6gYEwxTQOUnb/H3gsyKrVoT0Z6dzXJF1O//iFIhtm6KNptw+AlBI9eQB i14RYVMsTNMQ+r4P/xckphgA23UvVfV1iazJ38UrBEFVGCG1BYoQk0qvPLyl/Ey7LtWj h59g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701123049; x=1701727849; 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=8HtKu9iAXaV88hgxFxNvjjL2GaCw51rWrgIl23jSopU=; b=ry3vh5Op6sDVSNyIOOI+Z/wFogLsTL0tm6Mr8HssoyyW0PMirmA0tCzs8rBNKIRBF1 afUDEREIVgkm/N6H+PDjN1oQ1GXzUmMOT/ct8fE8bxNOcFPGB8trSaWDuU60rDQzo+o+ ypgB5D+CthiQ26fC8W9Vl5hvKTE7z9///SnsC9UHZjiEpE3IU3Rgotgs9SVnHDUutDE2 6frlzHdlYR7HYqzPOxuqHTDh3HgqnFPX2VtX2HCv5+06L+9FmHVXSs0gbMeBaReMkJ1N agpHbZP0J7B/k7BBCHcji1NMuzblsu2idNePZG0hd/PaVW7w386uK9LFCscvzUYogbVL xytw== X-Gm-Message-State: AOJu0YyYwKHo5jwoyHBynO3hGWPfWxIpK5b1Z7Q4oy48ZOksXkpKrhAq czQFt/usTa1MuAdg6HW8IEiWSyXMHOxP X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:829:6e77:9093:f39b]) (user=irogers job=sendgmr) by 2002:a25:24d8:0:b0:db5:2a4:c55b with SMTP id k207-20020a2524d8000000b00db502a4c55bmr719ybk.2.1701123048730; Mon, 27 Nov 2023 14:10:48 -0800 (PST) Date: Mon, 27 Nov 2023 14:08:49 -0800 In-Reply-To: <20231127220902.1315692-1-irogers@google.com> Message-Id: <20231127220902.1315692-38-irogers@google.com> Mime-Version: 1.0 References: <20231127220902.1315692-1-irogers@google.com> X-Mailer: git-send-email 2.43.0.rc1.413.gea7ed67945-goog Subject: [PATCH v5 37/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 , 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" 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,T_SCC_BODY_TEXT_LINE, 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 agentk.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 (agentk.vger.email [0.0.0.0]); Mon, 27 Nov 2023 14:14:34 -0800 (PST) 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.rc1.413.gea7ed67945-goog