Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp88918lqg; Thu, 29 Feb 2024 21:40:10 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWmUvVFFy+omesjx+ShUamy+hpdxCSEe38VZynn7BsSk178kXr9afjX+JM9NH5JdO3Z6kA26A7r8xnn2tmpSxFAfXcRfFEqCu53xOqViA== X-Google-Smtp-Source: AGHT+IEvEd83aj8eXAbjB7a0D1cyr4PSb+T7NUsh5gb1O9/eMHD110P5y+UXRtgCYN7BVX6yzEbp X-Received: by 2002:a05:6808:4189:b0:3c1:3f84:7a95 with SMTP id dj9-20020a056808418900b003c13f847a95mr701707oib.14.1709271610667; Thu, 29 Feb 2024 21:40:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709271610; cv=pass; d=google.com; s=arc-20160816; b=aVujfuCwnSzGrNlaffid5YyGFli8zK2UIjMhouR7yA5ttSKDJ/ke87P8UlloQuckF/ ey0FN6z2ckrCILy3mOugXunuwuD5+X/sRoSzXNsq9chlxxtdPOC5oCaY/VZXYM/kb1Mw kzXT9lTWJsYr3jh4+8iibWIHXryVZ2dIizk3YJaU/9TpMCVLbSCyCO7GzL6c1mvLRFhX +3Urv3eOTN6n9gLEgw1bwrP5xjQj2+7Bt33BYclgkbwnBcbQnBXua1NIC+jmgg9MXXNg rpp6TmpjQhDacioULf399xdIARMX9L/FAhPwjhS5GGk6NR+mD43FBAltzXWPhsP0Szll 8e6A== 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=h3EeOnj2LJFuh4Gzgf1odB7yRFHxb61zXSqdlmTf/sY=; fh=uVDBLhy7UdESYcC/ExNCNSmRx2u5ioObXYKUSnQlmxE=; b=xp0PyyWfJ1XARNwYtlTZ/q5yI/YeV3zKm4+kw5RcO+bCl+m/FeKsU8Vl71FkIayS5e Om065zT9X9K+DdStR5eW0i8eQixeuvmgdzDpOB3YJ10NY488WjAdrlKZaGCDndleQAb4 dt86dj3IpAjoGsboSlLe2T5C3m6kLifx7oXpprPG4RmFQOQjJywQPQk6fULcwCxWjTh+ 5QeWlJ/6GAhdAWfQY6WJBavagAsR6D9FyQLxEMorU8FWEW5Rvuv5BJ1phk3tloDTT9Qh ayuH8kzOaJIma0r7nx1yDQSzETyV8NvkMDRIc32tB/qFv3Z9rsK69l7q6pW3jLd1mhBN BxQg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=xQLSYKDJ; 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-87936-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87936-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id bd38-20020a056a0027a600b006e0f90ac3b8si2880909pfb.141.2024.02.29.21.40.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 21:40:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-87936-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=xQLSYKDJ; 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-87936-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87936-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id E30CFB248F2 for ; Fri, 1 Mar 2024 05:38:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F0E6155E4B; Fri, 1 Mar 2024 05:37:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="xQLSYKDJ" 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 B298554BFC for ; Fri, 1 Mar 2024 05:37:08 +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=1709271430; cv=none; b=KjWWl29lRotJbmej+aXiWnhZCpHkoIqn5w6FxKV1z3d34noQLCgYjYFV4AHMejKkNjD8qvSsz0gpgBs37ctlu6TtM7PSWGE2GxNwpDVQonnOGpnWLK3k/H+5Bjk37U+9svxTLy7r71o5Q99wH9+gMXPKUJxFD5aVfWQpHN7I0Jg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709271430; c=relaxed/simple; bh=GIegngHqtLjHARUsBjYE1nUvvYzurvCdwBU55T25Zws=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=tfJmZsougO3t0uGs7ymIe4kf0sHMfA1TuD4Ymg/grxcW03l2htl1RxGlZ+z2Sf2byy2lywubZ3/TMoa9PtQXsfGzHF8ZF3mwDcj47+lUqRDya0Ds7v9yjnOliQM73t/9zWC1El7+ECcONOG1R0+eoA2+F9tqRgWwNdmp4ilGG1w= 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=xQLSYKDJ; 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-6087ffdac8cso26288767b3.2 for ; Thu, 29 Feb 2024 21:37:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709271427; x=1709876227; 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=h3EeOnj2LJFuh4Gzgf1odB7yRFHxb61zXSqdlmTf/sY=; b=xQLSYKDJmoaE+yJNvdjYjShfCm7eK04b3GLGi2U3N5GvAS9YcB8vCk7OpmItFobhts 195HdHsABF1tJrM4Bh1DlxbnjDClsKPi/EBzuwfmvOo2JpRXoF6pGIB1DgwxZ8eJJ0N7 CklgfszI1bqzu19u3ftFqEZB1edr00ki94uK8WaTnVcVmj51booCGqpfjzrwLhF2pBsV xxgQT3Ip7mi5zeAtgP9o8sYqF6IvW8WEzWDWFd1HELnTgHOtJwA1HwMmfpY8gADj7T0P obIEV+00Ihr42PS5GNDphI2YNA+7meByKQ/Wc9Mn4APnr9JFJ0C44WW3hlikRxzXIPSF DmQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709271427; x=1709876227; 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=h3EeOnj2LJFuh4Gzgf1odB7yRFHxb61zXSqdlmTf/sY=; b=Lalglhs8nVshL2VQhlSodGKppLRUkWN4i+HauC4sXreSNFAR3wOIAoatyr05CXPGVX Bu5x0Qyq7pXEoCqsvYmyI/EzZaNslTXwfpQ9UrnSXuoTWrWgyyIh6oNrLIHaH1C8axie Z2iyghCRrpmLeOhuRi4/zmkRZBoTDc6T7goqYG6etMkS7nUfTTtx+ajRt9gUpwhnNImq 7Olpg6PyUk6wVlGjaC0Nv+NEi3D4b8hr7rPFXHtYT79Sd8Dbh7ekSimMWgmZBheMmDjs 6+1fdZPP9ycndS7y/WpGm4Anxxi2i9iaRFKzPsjOjmltjiBCpo/IuYhKMU+IgvO1O/+h o0Pg== X-Forwarded-Encrypted: i=1; AJvYcCXc/9LijPozSai6GdZiPpawDZpPxM5wM4AgaWIqnVx4iQmd0B8zScBLksOzrE9WTFNVlCoTASA0S4js7I56cLztW430Xzghu0DmWZi9 X-Gm-Message-State: AOJu0Yy1wnTYkCGjfyD11rqh52XCYz/Gq9Cfk8UR7DrG+Oj1ir2GYMgL IbeWgST3SLTHIZfN0fCQRvksVWvh5XYkeARqfFhOW0KbVDNxFTrCpRDrrM5Vi1+CDacSUvvnuyq c6lLbDg== X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:af4b:7fc1:b7be:fcb7]) (user=irogers job=sendgmr) by 2002:a05:6902:72f:b0:dc7:68b5:4f3d with SMTP id l15-20020a056902072f00b00dc768b54f3dmr130791ybt.11.1709271427758; Thu, 29 Feb 2024 21:37:07 -0800 (PST) Date: Thu, 29 Feb 2024 21:36:45 -0800 In-Reply-To: <20240301053646.1449657-1-irogers@google.com> Message-Id: <20240301053646.1449657-8-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240301053646.1449657-1-irogers@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Subject: [PATCH v4 7/7] perf threads: Reduce table size from 256 to 8 From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Oliver Upton , Yang Jihong , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org 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.44.0.278.ge034bb2e1d-goog