Message ID | 20240301053646.1449657-8-irogers@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-87936-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp876340dyb; Thu, 29 Feb 2024 21:38:53 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXulVCBu+irxcibfVnCR0P3H2BExm0gSk3MeKnI06WYyYB4JtPxFliZ1wDgmcEw4ptQZ0D7GYc9e3yKov9D4Y0k1OVi2w== X-Google-Smtp-Source: AGHT+IGU91Rq3Hz0a34/LapOcLl4kI9j0k6B+H31gKgq5HH6o2DJ2k+ZRvcCWMZ/24hjtxpKm2Il X-Received: by 2002:a05:6a00:14c9:b0:6e5:7045:59b1 with SMTP id w9-20020a056a0014c900b006e5704559b1mr875639pfu.19.1709271533034; Thu, 29 Feb 2024 21:38:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709271533; cv=pass; d=google.com; s=arc-20160816; b=YdSa1ClFsGXJg/E2/CZidyfFcFBSZjIKFu3CzoZShA7nnjQV4Py9slDVHN00KW3JWl 1m1w7h8e6OSWqhM/03QjN3USwZWu4/v+84xHqyg+p2jEqQLuP61lO+xqDGtN0XH9EKqP 2+hpGuADrzwoQcHnrrdReBsZGoc8/bAF1q3nGBppBIA9NIv1tFSzTFdhf2BujIgcirZs +8GdJ4lkXXIWQ9vBav33Zj/OJupX8ZSyUTFNv2+tpd9xgZsXx3669wJB3OFgpue/ZPxC KtiiYPGNsGNg8+MZ3qJZu/hmvPefQ2BKwi1ej5HC7h5ehpLpsK6IZCx8S5uAJ4I4MVKd YaeA== 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-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87936-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id w2-20020a636202000000b005dbec3481efsi2870518pgb.91.2024.02.29.21.38.52 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 21:38:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-87936-ouuuleilei=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=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-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87936-ouuuleilei=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 D35CF28376E for <ouuuleilei@gmail.com>; Fri, 1 Mar 2024 05:38:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 00FF656756; Fri, 1 Mar 2024 05:37:13 +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 <linux-kernel@vger.kernel.org>; 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 <linux-kernel@vger.kernel.org>; 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: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> 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 <irogers@google.com> To: Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>, Arnaldo Carvalho de Melo <acme@kernel.org>, Namhyung Kim <namhyung@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>, Adrian Hunter <adrian.hunter@intel.com>, Oliver Upton <oliver.upton@linux.dev>, Yang Jihong <yangjihong1@huawei.com>, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792301106658480327 X-GMAIL-MSGID: 1792301106658480327 |
Series |
Thread memory improvements and fixes
|
|
Commit Message
Ian Rogers
March 1, 2024, 5:36 a.m. UTC
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 <irogers@google.com>
---
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 {