From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753376AbbFSFuK (ORCPT ); Fri, 19 Jun 2015 01:50:10 -0400 Received: from mga09.intel.com ([134.134.136.24]:3915 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750868AbbFSFuH (ORCPT ); Fri, 19 Jun 2015 01:50:07 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,643,1427785200"; d="scan'208";a="713728427" Message-ID: <5583AD8C.1080500@intel.com> Date: Fri, 19 Jun 2015 08:50:04 +0300 From: Adrian Hunter User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Arnaldo Carvalho de Melo CC: Ingo Molnar , linux-kernel@vger.kernel.org, Jiri Olsa Subject: Re: [PATCH V6 02/17] perf tools: Ensure thread-stack is flushed References: <1432906425-9911-1-git-send-email-adrian.hunter@intel.com> <1432906425-9911-3-git-send-email-adrian.hunter@intel.com> <20150618215646.GI3079@kernel.org> In-Reply-To: <20150618215646.GI3079@kernel.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19/06/2015 12:56 a.m., Arnaldo Carvalho de Melo wrote: > Em Fri, May 29, 2015 at 04:33:30PM +0300, Adrian Hunter escreveu: >> The thread-stack represents a thread's current stack. When >> a thread exits there can still be many functions on the stack >> e.g. exit() can be called many levels deep, so all the callers >> will never return. To get that information output, the >> thread-stack must be flushed. >> >> Previously it was assumed the thread-stack would be flushed >> when the struct thread was deleted. With thread ref-counting >> it is no longer clear when that will be, if ever. So instead > > It'll be when the last reference to that thread is released. > > - Arnaldo > >> explicitly flush all the thread-stacks at the end of a session. > > If after the session ends you have no more need for those thread stacks, > that is the right way to do it. > > With tools like 'report', after the session ends we should have all the > unreferenced threads deleted. > > Previously they were not being deleted at all, i.e. they were simply > moved to the dead_threads list and sat there because I didn't knew if > some hist_entry, say, had a pointer to it. > > So, unless I am missing something, this patch is required irrespective > of thread refcounting, no? IIRC we used to delete all the dead threads too, but explicit flushing is better in any case. > > I'm applying it to my work branch where I'm trying to test all this. Thank you!