Message ID | 20240227220150.3876198-1-irogers@google.com |
---|---|
Headers |
Return-Path: <linux-kernel+bounces-84079-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2989314dyb; Tue, 27 Feb 2024 14:03:15 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX96+yefydSsJdfM3nGRETAI0Cy1JvPP6j1MRd/FixDZcHrFGNq5EB5LMnVxMULktpCIyaiHuBogcd5+/Jmchm3DBk89A== X-Google-Smtp-Source: AGHT+IHwp3Qt8/LymXTQ2eT17rhLkBKPdNxQMXc/XyVsxm4YG5buT0QTqa7g0i+S3xRtWnfkOUhw X-Received: by 2002:a05:6a20:d391:b0:19e:c9ad:68be with SMTP id iq17-20020a056a20d39100b0019ec9ad68bemr3857125pzb.43.1709071395576; Tue, 27 Feb 2024 14:03:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709071395; cv=pass; d=google.com; s=arc-20160816; b=UupBXD+n2D3IX692Bt3Nfrz8va+SJOx79zsEcAmVHtIGxqoxOpY5RxuBmdlHqQxnov cp5HJcRYNHOZS1WSUCXur2chbYD5UZ9fs+VBjkoW5DbW9CFFH437TxzIBvpoVKunU3Po /NBuASc7CrEEw8rSYfWfNkxP5OdEZu31QVa5T/6+sobKl26kGMlomJvYSH77HTBynZZ0 9DGDgx/xaUWvKCj3vyMYcNXjT2wKCVCcElUp4bEKEYc4EbrgmpKpMbbfgOqJupq2RpbF kZAzE/I3TZO9ySWWspsRBRSr70sCvPUrM4ES6R47eTnj+K+S5usOgPVk/0viDKTYI/xl 2t1g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:from:subject:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:date:dkim-signature; bh=oJ3hOQ4sjw8PBE4NTH5bCPktPJ1q6cfg+IS2J6sU/VQ=; fh=83Cm1P2Z908KKXAHgOLYrshwV0vmJWMLu7LzVZZr1Ik=; b=M4IRPr8qNCrWKnQpEFSSlYGQK29SbtXE6upeJtzlmm/CzLdKSk3JKI3bQtt8Tx0xDW 2hqU3duyfgWRqJ2+rpxUAyuXnGhw81mqHxArvjolpkCPR16NKb99xyJFV/sUmKMNW09W cL75sAeV3z3IiIVUM8ExTpeZBDBHkeNkzaPdP6nPEK8KUNin0obpgdmAoZhz3+cOQRnE BMEZ4YqxBX8c9HNFkwItL3Iq1fPiBpGE0gLOIfS68VC/L9TJv5tcgv1wI2JIfRs++9nw kqI8TnjsO0RvcIZERigCcDTbPFi6THa/2418LvKeT2VNjxJRtEy3vfv3Sv5EkNvSUjzt uEWg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=NAQjr5l2; 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-84079-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84079-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. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 21-20020a631155000000b005dc9daed2d2si5956538pgr.429.2024.02.27.14.03.15 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 14:03:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84079-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=NAQjr5l2; 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-84079-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84079-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 27A82288F7B for <ouuuleilei@gmail.com>; Tue, 27 Feb 2024 22:02:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B9E7A1509A0; Tue, 27 Feb 2024 22:02:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="NAQjr5l2" Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (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 6F6FC14F972 for <linux-kernel@vger.kernel.org>; Tue, 27 Feb 2024 22:02:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709071323; cv=none; b=dvggYzAz3h/jDaomJBrOgUOPcuK0WZf1OC5JPTUmhtRmXronNEtGto32UdxMHPfEtowtkKAmwl3Mkki/kmkPCvRtFtbmixIsJitctxRI8rz6ZgWvm6O56SgSWnHIMTh9QiUsCwpq65FAhRHZ9iOnxcvvT8zNb7NDHJqGPB+WQTs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709071323; c=relaxed/simple; bh=ukWrWX/4QAJImSWXYY9VHw3tM0MRjPKz7OGm8pghIEE=; h=Date:Message-Id:Mime-Version:Subject:From:To:Content-Type; b=j4d/joLPxncii2K2oR30JuHdYvLTxcSzcXuBhw/kNtBP2/4aMIij4A5Og7iSZCtXwb6FcJFcnWwgVSqX9cXIpVBM3biPZMjO17sODBVjstTVVnGseLGtmoWp296xg0hv1YuvUN+c4Zpaxi422GAUYxjR/l+NZT23la7j1K92MHk= 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=NAQjr5l2; arc=none smtp.client-ip=209.85.219.202 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-f202.google.com with SMTP id 3f1490d57ef6-dc6b26783b4so5973290276.0 for <linux-kernel@vger.kernel.org>; Tue, 27 Feb 2024 14:02:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709071321; x=1709676121; darn=vger.kernel.org; h=to:from:subject:mime-version:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=oJ3hOQ4sjw8PBE4NTH5bCPktPJ1q6cfg+IS2J6sU/VQ=; b=NAQjr5l257jm1gv8jDmx2tFDw/wgZulnnPZ5bqUJrWR66P44wMmguOuKe9zS+ll74S 3g9u1pLv0f7mLjdnmxp1LS0fRI/kflnnOhnmJbCbKhnTeKpXQkvGhSe9PHtMKwH1fl+5 dV/5MM23ez7Q0vw1nE7i3SmHdJ98ksnMAGTTEjj59omYvgpYHtD6VzaHWdUdVPw32Tzd LMi0OA3NujgLQbQIhEE9iymb3H6NT2nJpEAIz3WML81TiDUBJLzMNI8M/BJYRGiYfW4k exAkr0tVWCWAk9HTnY7LhymptE34zt9zo/mY/uuvVM4eIKIY5L2Xh5b3z3lhEiUIoOcF /qsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709071321; x=1709676121; h=to:from:subject:mime-version:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=oJ3hOQ4sjw8PBE4NTH5bCPktPJ1q6cfg+IS2J6sU/VQ=; b=RcefxHt+vBTkn12qhiZkjQa3ldWK/t07NonXLyTcXhLQIgUqg1MVM7MPzmDDrcYAjC i477D/n+DNEZdHkiDzSTT/aJ10C8h60FcOhvqbi/jNwbaW6q1NC7/XXcBSBxqSz3xyP0 xLlDuKomvmsmzeCWcFc0lG7U1rrrnruF5snJEYFoj4f7y8FQQ5THlneyR64ehaQ3yicf 6rQIKP3eKAn9fTB/XNy6n3HUY9+Ok5EJVIjisiEKG83NbYyln1wngMTVKvXpCG/jO01O /yzU4Yry5xBScUw0prM4DXfJ/hesMwoBb8t2eHFgFoDz/w3DPgTmsEBcRo0S32sG9FSA Dc9g== X-Forwarded-Encrypted: i=1; AJvYcCWWpLxVR2qdHiSHcU+V/Xw9tJ0aQTnKbpkzU9F0AgpiQoVQSDfITNgRN0RmN8rj65EgAvLu3Yuxvwb4+ckuWEsvGuAO6RMbSPdaXx2k X-Gm-Message-State: AOJu0Yy5bypX1xt8gjkcISXqvnT7nFwtJNxEETiQcFNHYAxnPQHZd8g4 KUCpDrM8v8weccMxTZGi58T0j2WihVcCqXOdCiZQy+RePpYV8HtWeJaoS9gO1Mdi3soub+hImOH zf9hTbA== X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:4ff1:8af6:9e1a:6382]) (user=irogers job=sendgmr) by 2002:a05:6902:1891:b0:dc7:82ba:ba6e with SMTP id cj17-20020a056902189100b00dc782baba6emr55224ybb.7.1709071321432; Tue, 27 Feb 2024 14:02:01 -0800 (PST) Date: Tue, 27 Feb 2024 14:01:44 -0800 Message-Id: <20240227220150.3876198-1-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 X-Mailer: git-send-email 2.44.0.rc1.240.g4c46232300-goog Subject: [PATCH v2 0/6] Thread memory improvements and fixes 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>, Kan Liang <kan.liang@linux.intel.com>, Oliver Upton <oliver.upton@linux.dev>, Yang Jihong <yangjihong1@huawei.com>, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, bpf@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792091247608151146 X-GMAIL-MSGID: 1792091247608151146 |
Series |
Thread memory improvements and fixes
|
|
Message
Ian Rogers
Feb. 27, 2024, 10:01 p.m. UTC
The next 6 patches from: https://lore.kernel.org/lkml/20240202061532.1939474-1-irogers@google.com/ now the initial maps fixes have landed: https://lore.kernel.org/all/20240210031746.4057262-1-irogers@google.com/ Separate out and reimplement threads to use a hashmap for lower memory consumption and faster look up. The fixes a regression in memory usage where reference count checking switched to using non-invasive tree nodes. Reduce threads default size by 32 times and improve locking discipline. Also, fix regressions where tids had become unordered to make `perf report --tasks` and `perf trace --summary` output easier to read. v2: improve comments and a commit message. Ian Rogers (6): perf report: Sort child tasks by tid perf trace: Ignore thread hashing in summary perf machine: Move fprintf to for_each loop and a callback perf threads: Move threads to its own files perf threads: Switch from rbtree to hashmap perf threads: Reduce table size from 256 to 8 tools/perf/builtin-report.c | 217 +++++++++------- tools/perf/builtin-trace.c | 41 +-- tools/perf/util/Build | 1 + tools/perf/util/bpf_lock_contention.c | 8 +- tools/perf/util/machine.c | 344 +++++++------------------- tools/perf/util/machine.h | 30 +-- tools/perf/util/rb_resort.h | 5 - tools/perf/util/thread.c | 2 +- tools/perf/util/thread.h | 6 - tools/perf/util/threads.c | 186 ++++++++++++++ tools/perf/util/threads.h | 35 +++ 11 files changed, 477 insertions(+), 398 deletions(-) create mode 100644 tools/perf/util/threads.c create mode 100644 tools/perf/util/threads.h