From patchwork Thu Feb 29 06:32:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 208216 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp210094dyb; Wed, 28 Feb 2024 22:35:48 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVq/Z4K+u8ulco2GwnGnF58cOAPGtYTJxPcL8zO22ncx4Mupx3Oc3aRnXB39b8JBslIfbBmqEWnj3RBcn+4x/d4aSg2mw== X-Google-Smtp-Source: AGHT+IFrLYxJMMEuGiOVzJrwIlNmjawCSM64u7r2ilojsjUmIRqyHPiT+z8UktJ9//KMnUmOoaMa X-Received: by 2002:a17:906:7c06:b0:a44:505f:bfa9 with SMTP id t6-20020a1709067c0600b00a44505fbfa9mr164003ejo.58.1709188548031; Wed, 28 Feb 2024 22:35:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709188548; cv=pass; d=google.com; s=arc-20160816; b=IYkywQHfyK0O37qbYCLQdGs+3LeCieT/admS5iqrJNkqEZQexWQMpxYAxxDrj5EGrO P+3AsQwquD7orvCyXU9C09KU2OvtfhioQAdj6D0gDf//yjt8HKIm8i5D5CT86fw50IFq 1tcp2XQDwwUqDZQswU6kzxv/sQ8EAm5xaNOXJ3pLx934Tw9Bsef9D4KVmODDUlrHXDTe jCB9dGNhJBDTPCsGaDpOXXy7PgNEH8f98CWLhVm9US8seYySgX7vnPa2O16pFJTYngMv 4+TFG1wt7xof7q4h8fOhTJ++nAtUZWGYdTk2JB+s+cavxgsiwho5AluUnpKGna4KkBhK PszA== 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=GomGuibOhxdK0XyI5V4KUyK7yCiFqYRuvRImaXZmt+E=; b=qEpIMU7kdYvy2gkoZh59cZv2MDMprtRpRqwZ6P9D1tXTbFRlB8I4/T9cLZlSVisb+j Owu/bVFSoAO8cwRB1PlnfOehzXZCVRH4IYabZCmRy5mCL9l6U6uEwB3GyPnk6AdLspa6 873WBhaMNknfUI8VpS48snI5cBr6crsZ4S+xSGB39BowIU4dwYjlX5P0gQ+U2lgXKdpX T8ewM8EzSYuGyBluXRY0VMORwg1p5udAq2cKwuzhrydIXJm09TUOLUPIThvKsUzyaM1/ xQAgzpGW/SKnn09Me9KjPiFYTfbTtBgFGsFahP1aFwOsvukaKcWfJ3KAM997nwFojHTz wQWw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=YKbaYtCx; 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-86179-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86179-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id jt20-20020a170906ca1400b00a3ed86dc13bsi302496ejb.265.2024.02.28.22.35.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 22:35:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-86179-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=YKbaYtCx; 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-86179-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86179-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 56B391F23686 for ; Thu, 29 Feb 2024 06:35:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 45CC6482E6; Thu, 29 Feb 2024 06:33:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="YKbaYtCx" Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.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 0693746449 for ; Thu, 29 Feb 2024 06:33:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709188399; cv=none; b=ufs/UaIZj7IprPZjp0xxMnzL8h+NLteUVGRFcVjxRk0AmWo3pjY80tEQtIJU3pW5WuUn/qyw088S8/bqbkmDWeXWxUhX5DAfZKsOexL5iuRA9QuJ2AHVsqBxBgquP/V+qD8ni3oMSahLN2vMF9VdrBxMbVhkRQYI3ZHrIzQ2Wlk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709188399; c=relaxed/simple; bh=GIegngHqtLjHARUsBjYE1nUvvYzurvCdwBU55T25Zws=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=mCLt+WujZvI6pqg/VQtzzLVaTGHB7Eu4ugPFMV654YGc2ccgLpiewQGxv7BVrTO8Rweq1FgMDT3fh8firQOQYDxDc2BeUBphO/spWNVmOrkicRp0HujIKjUC1U/HjSrcwCX5oDmFGsXYxoggxRwLBG1Bmf34iUPArhhhYT2Lo+o= 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=YKbaYtCx; arc=none smtp.client-ip=209.85.219.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-yb1-f201.google.com with SMTP id 3f1490d57ef6-dccc49ef73eso1053299276.2 for ; Wed, 28 Feb 2024 22:33:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709188397; x=1709793197; 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=YKbaYtCx+lHpwSTy4H1SVfzQA5K2rjaMGXeA/TxUBTq1htoEcqrrpgSqp+fAB89tIT sdUQQ7d4XFL7McpnXfYUIGJCUobTTlIk+gjU4W2fd7MKXpplEq3S9U84oWDaOlaRB04f CNh2DvhmC1PhzMghrFAe6BiDnh66URMhK5bquNuUhfFvipHm1Z6Pf7VHEYqa/EQHq7Kp UqS9iUlPcL5LJf0SndhQdg1WWWGZ4uZed5oOHSVrN6AiEPywH5uEC1DN05uqwWbV7s4W Ysda8asjM9a4AunDitegMEgWKXwrvtuGYezoRW6+qOckXeRE+5B1g92RIe7Zq4HbLXO9 Ulpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709188397; x=1709793197; 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=IAsXIRr9gxPYF6PKeq1LNuOR9AjRoBu+A/akxpRDOftaGU3fWq6IXf9q50MumyG6hq qX6AMm60OcboGLwBLKVZ53kUJBcNBZVq8sPwybeSVc/LNZjKw1Xs0FkZCKsHMd/CSZuo X1sPJCc5hNUuVQyO+D9WrfMeDzeVpeO96TOxnp1ub5Fyfx3+Q5RRpI1M78odA8KD5GvN ZWxMa0HIS9dxr+yuS3bpL+Nm6Uk4GRSHTn6Mh1wzKIxRKRDt0YqHCjFRa10sZ86wZO1O lTXy5fN4zyuSva9j9iSturpNbidof41v9f/BSTd1WuJHRcO6QcEqinWjhC8+H3bO8Ik8 nMDA== X-Forwarded-Encrypted: i=1; AJvYcCWzJQd/yOsBc+JmQhQBvWP1OryeRaEJ5Ev9Xl7MSuDnuqeqn2wbAsz3kDil2DXJWki/YZtIAEtyU5Y7S8LtrF6FJkRCoIHL564QSq1t X-Gm-Message-State: AOJu0YxPckFFz2sIo+klElvn9Vfty151Ku4hM+mkQx7NgpD3MCAJ/O/F qe5i+rlUdjraD18K/JUgar1m/ZT+OdAGInk+Wl4hFIHQjm4Sjc0EPXjBFNiRkgD8FeKMeW5u9eW x1I7FuQ== X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:77dc:144c:334e:e2dd]) (user=irogers job=sendgmr) by 2002:a05:6902:150d:b0:dc6:d890:1a97 with SMTP id q13-20020a056902150d00b00dc6d8901a97mr59458ybu.9.1709188396983; Wed, 28 Feb 2024 22:33:16 -0800 (PST) Date: Wed, 28 Feb 2024 22:32:53 -0800 In-Reply-To: <20240229063253.561838-1-irogers@google.com> Message-Id: <20240229063253.561838-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: <20240229063253.561838-1-irogers@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Subject: [PATCH v3 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792214090938882559 X-GMAIL-MSGID: 1792214090938882559 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 {