Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1414963rda; Mon, 23 Oct 2023 11:49:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHeIhXNWzYhd6sY8SpcAMIxgb3U0QYfJzIpG1YNBXv4NGdN7jFWr8Jq3EvFXe4mcYUFsDON X-Received: by 2002:a05:6870:3893:b0:1dc:c65e:ded2 with SMTP id y19-20020a056870389300b001dcc65eded2mr10861345oan.12.1698086988287; Mon, 23 Oct 2023 11:49:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698086988; cv=none; d=google.com; s=arc-20160816; b=xHY0Z0JEAEsegVdbqAiR747Va41ASxsYXKprhScvZBmkl9Km38qwk3s+/lzpiaV/cI 6quXU5zTHA6crNiTC27+l6Kcj3csxKbE3CJ88VSnye3pjvb12ZOZyhpagB6l/vBCjNuT Xh1dco+jBps1yhjs7kRUk5MMylYZb/j7FH0UlrDKSA9nUVhbd5uBJ/86BHneUbY+oHBe um4zQdu372O4oDjH2B0Iw9cAoZPXbEOXLjVoGNavZwBhTFUJPVNQnU3DiZTUqS8ZHCQs IVTWr3LYiS5UH2TC3WPised7tIG5iTcQ+AU/SSCI65uYHde8UX5e925e5fCU/5xO96Iz kXvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=WBjinH4YO+2hSUCb0fHvQc14NdFtTudqRmx2oJc8QDw=; fh=qwxshGX4DO2MQ/BdLoxSiJpZ2FFdRTo+qUDwdZsIGnM=; b=OoCb9gFP2KlyCM2NA2lixU2f45I8ZhQfjfz/XkhA0tscIwt1vSIZvnqReFWtZ3WQCD dh+PLQtADEHlThXHt96N+Wjef/wP/Y5s84r+CTZcBKSQiUbmNHG5ZmnCorb+Z/7Bfz1I 6+lv6aju6u988j0tNUDJr4vt857o8AnWWAS6JWDtIyUH850ja+AkundYo4wf8RFYo4rp BzqqwJMI3NRJBu3NTZ5OAQLyT0/EKfYLkO8zEc2w/eoFfFNU9ZkdPyRrn8B/3mMM9Kme hpRIHN54AYFAKftsk9Vj9hnqXtKPYsz6VdUS191Up7LRzsfO0OjvSWU9wUw8TAJLKong n1jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=TrElkOID; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id h191-20020a6383c8000000b0059d25cedc5asi6675006pge.637.2023.10.23.11.49.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 11:49:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=TrElkOID; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id 6D26A805B206; Mon, 23 Oct 2023 11:49:44 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229557AbjJWStW (ORCPT + 99 others); Mon, 23 Oct 2023 14:49:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229451AbjJWStU (ORCPT ); Mon, 23 Oct 2023 14:49:20 -0400 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17BEB100 for ; Mon, 23 Oct 2023 11:49:17 -0700 (PDT) Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-507c9305727so521e87.1 for ; Mon, 23 Oct 2023 11:49:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698086955; x=1698691755; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=WBjinH4YO+2hSUCb0fHvQc14NdFtTudqRmx2oJc8QDw=; b=TrElkOIDdyHkGZa2pRqKHPMC2NkI6Pq7qjDIfwRadW3PlIiE1h3Vv9JcMJibH27puR MEikxWSGsP5qLk360CnuDxauE0ml/KeLfYGAlVwsp5ovPlJ4sbkMVsNGK22nioLeHwDs e/rd8XHzvbsiLXcK5isXGTLFhqCIABnabKWlR3vtJoy1y3pE8t2BpFv7h9nQGgGx5B8V HE2ZSUE78xw6OI/Eh23MHOfaWispUUBE2hZTXbEJcrg2cMcuL13XbAZ8irMsZgk3tnH/ jX2qbEnIK8pnxazzIw4XlFWW/dRBuj3m6kwFgCIA2Cpkp0JqPHrf5TaQWVgrCyvGmJbA cpEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698086955; x=1698691755; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WBjinH4YO+2hSUCb0fHvQc14NdFtTudqRmx2oJc8QDw=; b=tkDxObvGIf1AwOENroIn891VQautA2+iNneUC+oA3HGVgpv4kqALfEP26c1SopB03Y AYMPCHP/pX52Q1uMVgPOPif3AXgC+VDHEBreQK4IKeDgoJHD2hY4PH8Ys63B2Fk85cCQ mlfjNd/i/Ur5iEe8LeR38+MV8QqGyGqg9Xl4LWMEvyxrJ1Vg11MFtu0yoILbY1XUiO5G tVoMlNrYiZybcTRBgREq5lFHaeZOFy7nF4WC8tRIk/AgKxhL0oH6zrIwtei508ZLocT8 4eg6hIvHNBwztrN1F1os/xQ4m5eyc7J1AgGUKKpsxT5sPxKIxmHUksu0QiuUJ4PiHoEW Sjdw== X-Gm-Message-State: AOJu0Yzspu2FkLitkm1A5x5pvZtiZ+cfPn/MdJ8pE4u3GaebZqKrYnM7 NZPi4Uj/j2nurIpskrgu4UqSsZeMv/1Zh4B8vHxD+Q== X-Received: by 2002:a05:6512:3685:b0:505:7c88:9e45 with SMTP id d5-20020a056512368500b005057c889e45mr14376lfs.0.1698086954981; Mon, 23 Oct 2023 11:49:14 -0700 (PDT) MIME-Version: 1.0 References: <20231012062359.1616786-1-irogers@google.com> <20231012062359.1616786-14-irogers@google.com> In-Reply-To: From: Ian Rogers Date: Mon, 23 Oct 2023 11:49:00 -0700 Message-ID: Subject: Re: [PATCH v2 13/13] perf machine thread: Remove exited threads by default To: Adrian Hunter Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Nick Terrell , Kan Liang , Song Liu , Sandipan Das , Anshuman Khandual , James Clark , Liam Howlett , Miguel Ojeda , Leo Yan , German Gomez , Ravi Bangoria , Artem Savkov , Athira Rajeev , Andi Kleen , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, bpf@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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,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 fry.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 (fry.vger.email [0.0.0.0]); Mon, 23 Oct 2023 11:49:44 -0700 (PDT) On Mon, Oct 23, 2023 at 7:24=E2=80=AFAM Adrian Hunter wrote: > > On 12/10/23 09:23, Ian Rogers wrote: > > struct thread values hold onto references to mmaps, dsos, etc. When a > > thread exits it is necessary to clean all of this memory up by > > removing the thread from the machine's threads. Some tools require > > this doesn't happen, such as perf report if offcpu events exist or if > > a task list is being generated, so add a symbol_conf value to make the > > behavior optional. When an exited thread is left in the machine's > > threads, mark it as exited. > > > > This change relates to commit 40826c45eb0b ("perf thread: Remove > > notion of dead threads"). Dead threads were removed as they had a > > reference count of 0 and were difficult to reason about with the > > reference count checker. Here a thread is removed from threads when it > > exits, unless via symbol_conf the exited thread isn't remove and is > > marked as exited. Reference counting behaves as it normally does. > > Can we exclude AUX area tracing? > > Essentially, the EXIT event happens when the task is still running > in kernel mode, so the thread has not in fact fully exited. > > Example: > > # perf record -a --kcore -e intel_pt// uname > > Before: > > # perf script --itrace=3Db --show-task-events -C6 | grep -C10 EXIT > uname 14740 [006] 26795.092638: 1 branches: ffff= ffffb63124ee __perf_event_header__init_id+0x5e ([kernel.kallsyms]) =3D> fff= fffffb63124f7 __perf_event_header__init_id+0x67 ([kernel.kallsyms]) > uname 14740 [006] 26795.092638: 1 branches: ffff= ffffb6312501 __perf_event_header__init_id+0x71 ([kernel.kallsyms]) =3D> fff= fffffb6312512 __perf_event_header__init_id+0x82 ([kernel.kallsyms]) > uname 14740 [006] 26795.092638: 1 branches: ffff= ffffb6312531 __perf_event_header__init_id+0xa1 ([kernel.kallsyms]) =3D> fff= fffffb6316b3a perf_event_task_output+0x26a ([kernel.kallsyms]) > uname 14740 [006] 26795.092638: 1 branches: ffff= ffffb6316b40 perf_event_task_output+0x270 ([kernel.kallsyms]) =3D> ffffffff= b6316959 perf_event_task_output+0x89 ([kernel.kallsyms]) > uname 14740 [006] 26795.092638: 1 branches: ffff= ffffb6316966 perf_event_task_output+0x96 ([kernel.kallsyms]) =3D> ffffffffb= 6322040 perf_output_begin+0x0 ([kernel.kallsyms]) > uname 14740 [006] 26795.092638: 1 branches: ffff= ffffb6322080 perf_output_begin+0x40 ([kernel.kallsyms]) =3D> ffffffffb6194d= c0 __rcu_read_lock+0x0 ([kernel.kallsyms]) > uname 14740 [006] 26795.092638: 1 branches: ffff= ffffb6194de1 __rcu_read_lock+0x21 ([kernel.kallsyms]) =3D> ffffffffb6322085= perf_output_begin+0x45 ([kernel.kallsyms]) > uname 14740 [006] 26795.092638: 1 branches: ffff= ffffb63220ce perf_output_begin+0x8e ([kernel.kallsyms]) =3D> ffffffffb611d2= 80 preempt_count_add+0x0 ([kernel.kallsyms]) > uname 14740 [006] 26795.092638: 1 branches: ffff= ffffb611d2bf preempt_count_add+0x3f ([kernel.kallsyms]) =3D> ffffffffb63220= d3 perf_output_begin+0x93 ([kernel.kallsyms]) > uname 14740 [006] 26795.092638: 1 branches: ffff= ffffb63220e8 perf_output_begin+0xa8 ([kernel.kallsyms]) =3D> ffffffffb63220= ff perf_output_begin+0xbf ([kernel.kallsyms]) > uname 14740 [006] 26795.092638: PERF_RECORD_EXIT(14740:14740= ):(14739:14739) > uname 14740 [006] 26795.092638: 1 branches: ffff= ffffb6322119 perf_output_begin+0xd9 ([kernel.kallsyms]) =3D> ffffffffb63221= 28 perf_output_begin+0xe8 ([kernel.kallsyms]) > uname 14740 [006] 26795.092638: 1 branches: ffff= ffffb6322146 perf_output_begin+0x106 ([kernel.kallsyms]) =3D> ffffffffb6322= 0ea perf_output_begin+0xaa ([kernel.kallsyms]) > uname 14740 [006] 26795.092638: 1 branches: ffff= ffffb63220f9 perf_output_begin+0xb9 ([kernel.kallsyms]) =3D> ffffffffb63221= ab perf_output_begin+0x16b ([kernel.kallsyms]) > uname 14740 [006] 26795.092638: 1 branches: ffff= ffffb63221ae perf_output_begin+0x16e ([kernel.kallsyms]) =3D> ffffffffb6322= 1b6 perf_output_begin+0x176 ([kernel.kallsyms]) > uname 14740 [006] 26795.092638: 1 branches: ffff= ffffb6322202 perf_output_begin+0x1c2 ([kernel.kallsyms]) =3D> ffffffffb6322= 167 perf_output_begin+0x127 ([kernel.kallsyms]) > uname 14740 [006] 26795.092638: 1 branches: ffff= ffffb632218c perf_output_begin+0x14c ([kernel.kallsyms]) =3D> ffffffffb6316= 96b perf_event_task_output+0x9b ([kernel.kallsyms]) > uname 14740 [006] 26795.092638: 1 branches: ffff= ffffb6316990 perf_event_task_output+0xc0 ([kernel.kallsyms]) =3D> ffffffffb= 61034a0 __task_pid_nr_ns+0x0 ([kernel.kallsyms]) > uname 14740 [006] 26795.092638: 1 branches: ffff= ffffb61034b7 __task_pid_nr_ns+0x17 ([kernel.kallsyms]) =3D> ffffffffb6194dc= 0 __rcu_read_lock+0x0 ([kernel.kallsyms]) > uname 14740 [006] 26795.092638: 1 branches: ffff= ffffb6194de1 __rcu_read_lock+0x21 ([kernel.kallsyms]) =3D> ffffffffb61034bc= __task_pid_nr_ns+0x1c ([kernel.kallsyms]) > uname 14740 [006] 26795.092638: 1 branches: ffff= ffffb6103503 __task_pid_nr_ns+0x63 ([kernel.kallsyms]) =3D> ffffffffb610353= b __task_pid_nr_ns+0x9b ([kernel.kallsyms]) > > After: > > $ perf script --itrace=3Db --show-task-events -C6 | grep -C10 EXIT > uname 14740 [006] 26795.092638: 1 branches: ffff= ffffb63124ee __perf_event_header__init_id+0x5e ([kernel.kallsyms]) =3D> fff= fffffb63124f7 __perf_event_header__init_id+0x67 ([kernel.kallsyms]) > uname 14740 [006] 26795.092638: 1 branches: ffff= ffffb6312501 __perf_event_header__init_id+0x71 ([kernel.kallsyms]) =3D> fff= fffffb6312512 __perf_event_header__init_id+0x82 ([kernel.kallsyms]) > uname 14740 [006] 26795.092638: 1 branches: ffff= ffffb6312531 __perf_event_header__init_id+0xa1 ([kernel.kallsyms]) =3D> fff= fffffb6316b3a perf_event_task_output+0x26a ([kernel.kallsyms]) > uname 14740 [006] 26795.092638: 1 branches: ffff= ffffb6316b40 perf_event_task_output+0x270 ([kernel.kallsyms]) =3D> ffffffff= b6316959 perf_event_task_output+0x89 ([kernel.kallsyms]) > uname 14740 [006] 26795.092638: 1 branches: ffff= ffffb6316966 perf_event_task_output+0x96 ([kernel.kallsyms]) =3D> ffffffffb= 6322040 perf_output_begin+0x0 ([kernel.kallsyms]) > uname 14740 [006] 26795.092638: 1 branches: ffff= ffffb6322080 perf_output_begin+0x40 ([kernel.kallsyms]) =3D> ffffffffb6194d= c0 __rcu_read_lock+0x0 ([kernel.kallsyms]) > uname 14740 [006] 26795.092638: 1 branches: ffff= ffffb6194de1 __rcu_read_lock+0x21 ([kernel.kallsyms]) =3D> ffffffffb6322085= perf_output_begin+0x45 ([kernel.kallsyms]) > uname 14740 [006] 26795.092638: 1 branches: ffff= ffffb63220ce perf_output_begin+0x8e ([kernel.kallsyms]) =3D> ffffffffb611d2= 80 preempt_count_add+0x0 ([kernel.kallsyms]) > uname 14740 [006] 26795.092638: 1 branches: ffff= ffffb611d2bf preempt_count_add+0x3f ([kernel.kallsyms]) =3D> ffffffffb63220= d3 perf_output_begin+0x93 ([kernel.kallsyms]) > uname 14740 [006] 26795.092638: 1 branches: ffff= ffffb63220e8 perf_output_begin+0xa8 ([kernel.kallsyms]) =3D> ffffffffb63220= ff perf_output_begin+0xbf ([kernel.kallsyms]) > uname 14740 [006] 26795.092638: PERF_RECORD_EXIT(14740:14740= ):(14739:14739) > :14740 14740 [006] 26795.092638: 1 branches: ffff= ffffb6322119 perf_output_begin+0xd9 ([kernel.kallsyms]) =3D> ffffffffb63221= 28 perf_output_begin+0xe8 ([kernel.kallsyms]) > :14740 14740 [006] 26795.092638: 1 branches: ffff= ffffb6322146 perf_output_begin+0x106 ([kernel.kallsyms]) =3D> ffffffffb6322= 0ea perf_output_begin+0xaa ([kernel.kallsyms]) > :14740 14740 [006] 26795.092638: 1 branches: ffff= ffffb63220f9 perf_output_begin+0xb9 ([kernel.kallsyms]) =3D> ffffffffb63221= ab perf_output_begin+0x16b ([kernel.kallsyms]) > :14740 14740 [006] 26795.092638: 1 branches: ffff= ffffb63221ae perf_output_begin+0x16e ([kernel.kallsyms]) =3D> ffffffffb6322= 1b6 perf_output_begin+0x176 ([kernel.kallsyms]) > :14740 14740 [006] 26795.092638: 1 branches: ffff= ffffb6322202 perf_output_begin+0x1c2 ([kernel.kallsyms]) =3D> ffffffffb6322= 167 perf_output_begin+0x127 ([kernel.kallsyms]) > :14740 14740 [006] 26795.092638: 1 branches: ffff= ffffb632218c perf_output_begin+0x14c ([kernel.kallsyms]) =3D> ffffffffb6316= 96b perf_event_task_output+0x9b ([kernel.kallsyms]) > :14740 14740 [006] 26795.092638: 1 branches: ffff= ffffb6316990 perf_event_task_output+0xc0 ([kernel.kallsyms]) =3D> ffffffffb= 61034a0 __task_pid_nr_ns+0x0 ([kernel.kallsyms]) > :14740 14740 [006] 26795.092638: 1 branches: ffff= ffffb61034b7 __task_pid_nr_ns+0x17 ([kernel.kallsyms]) =3D> ffffffffb6194dc= 0 __rcu_read_lock+0x0 ([kernel.kallsyms]) > :14740 14740 [006] 26795.092638: 1 branches: ffff= ffffb6194de1 __rcu_read_lock+0x21 ([kernel.kallsyms]) =3D> ffffffffb61034bc= __task_pid_nr_ns+0x1c ([kernel.kallsyms]) > :14740 14740 [006] 26795.092638: 1 branches: ffff= ffffb6103503 __task_pid_nr_ns+0x63 ([kernel.kallsyms]) =3D> ffffffffb610353= b __task_pid_nr_ns+0x9b ([kernel.kallsyms]) > > This will also affect samples made after PERF_RECORD_EXIT but before > the task finishes exiting. Makes sense. Would an appropriate fix be in perf_session__open to set: symbol_conf.keep_exited_threads =3D true; when: perf_header__has_feat(&session->header, HEADER_AUXTRACE) It is kind of hacky to be changing global state this way, but symbol_conf is like that in general. Thanks, Ian > > > > Signed-off-by: Ian Rogers > > --- > > tools/perf/builtin-report.c | 7 +++++++ > > tools/perf/util/machine.c | 10 +++++++--- > > tools/perf/util/symbol_conf.h | 3 ++- > > tools/perf/util/thread.h | 14 ++++++++++++++ > > 4 files changed, 30 insertions(+), 4 deletions(-) > > > > diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c > > index dcedfe00f04d..749246817aed 100644 > > --- a/tools/perf/builtin-report.c > > +++ b/tools/perf/builtin-report.c > > @@ -1411,6 +1411,13 @@ int cmd_report(int argc, const char **argv) > > if (ret < 0) > > goto exit; > > > > + /* > > + * tasks_mode require access to exited threads to list those that= are in > > + * the data file. Off-cpu events are synthesized after other even= ts and > > + * reference exited threads. > > + */ > > + symbol_conf.keep_exited_threads =3D true; > > + > > annotation_options__init(&report.annotation_opts); > > > > ret =3D perf_config(report__config, &report); > > diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c > > index 6ca7500e2cf4..5cda47eb337d 100644 > > --- a/tools/perf/util/machine.c > > +++ b/tools/perf/util/machine.c > > @@ -2157,9 +2157,13 @@ int machine__process_exit_event(struct machine *= machine, union perf_event *event > > if (dump_trace) > > perf_event__fprintf_task(event, stdout); > > > > - if (thread !=3D NULL) > > - thread__put(thread); > > - > > + if (thread !=3D NULL) { > > + if (symbol_conf.keep_exited_threads) > > + thread__set_exited(thread, /*exited=3D*/true); > > + else > > + machine__remove_thread(machine, thread); > > + } > > + thread__put(thread); > > return 0; > > } > > > > diff --git a/tools/perf/util/symbol_conf.h b/tools/perf/util/symbol_con= f.h > > index 2b2fb9e224b0..6040286e07a6 100644 > > --- a/tools/perf/util/symbol_conf.h > > +++ b/tools/perf/util/symbol_conf.h > > @@ -43,7 +43,8 @@ struct symbol_conf { > > disable_add2line_warn, > > buildid_mmap2, > > guest_code, > > - lazy_load_kernel_maps; > > + lazy_load_kernel_maps, > > + keep_exited_threads; > > const char *vmlinux_name, > > *kallsyms_name, > > *source_prefix, > > diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h > > index e79225a0ea46..0df775b5c110 100644 > > --- a/tools/perf/util/thread.h > > +++ b/tools/perf/util/thread.h > > @@ -36,13 +36,22 @@ struct thread_rb_node { > > }; > > > > DECLARE_RC_STRUCT(thread) { > > + /** @maps: mmaps associated with this thread. */ > > struct maps *maps; > > pid_t pid_; /* Not all tools update this */ > > + /** @tid: thread ID number unique to a machine. */ > > pid_t tid; > > + /** @ppid: parent process of the process this thread belongs to. = */ > > pid_t ppid; > > int cpu; > > int guest_cpu; /* For QEMU thread */ > > refcount_t refcnt; > > + /** > > + * @exited: Has the thread had an exit event. Such threads are us= ually > > + * removed from the machine's threads but some events/tools requi= re > > + * access to dead threads. > > + */ > > + bool exited; > > bool comm_set; > > int comm_len; > > struct list_head namespaces_list; > > @@ -189,6 +198,11 @@ static inline refcount_t *thread__refcnt(struct th= read *thread) > > return &RC_CHK_ACCESS(thread)->refcnt; > > } > > > > +static inline void thread__set_exited(struct thread *thread, bool exit= ed) > > +{ > > + RC_CHK_ACCESS(thread)->exited =3D exited; > > +} > > + > > static inline bool thread__comm_set(const struct thread *thread) > > { > > return RC_CHK_ACCESS(thread)->comm_set; >