Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp2465586ima; Mon, 22 Oct 2018 10:10:44 -0700 (PDT) X-Google-Smtp-Source: ACcGV61aFT61VMh31MKjFZr3Klq8jzS7MUYmr8QP7orEztQMo0tmOydD9BjXS8M5HPxM6BFRJS7w X-Received: by 2002:a63:24f:: with SMTP id 76-v6mr42949829pgc.67.1540228244014; Mon, 22 Oct 2018 10:10:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540228243; cv=none; d=google.com; s=arc-20160816; b=VbmwiiZaaG9JOwRn6iAYXPswSrt256SHA8rEQMyNwBLo1GnLOeXRscbuSsHE1J6QnH JrsLBbkUFLKzM0DyeN+ZDSA+r4ykUAeVc/chSCV9K/jRoitogZGZVmKe7BymB6U3xu83 etDKlDOrtGwBdpZvXgR11cbniuKX0Gkh1Jl4AAP8oddwm4WrxM2phby2epJVcHE4dU15 1gqreL75BXGMtj6YcK5XHz++uOqwwNeY5++Jw/f6GDggZFb4ROodctmFkDpDRpNfR5qt YCPmbjVQwKTVdw5qqX3oMS/CdPspbL/farWjc55XybaXcPOz0zNDPd2WuSfhELgMm1lB Bi1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=IxfXghfQi/rWNdHyhlPdO4UtFd0eLZVtbO/AoCTucdc=; b=cUwOOUWsyC3o5TycGC7hsP3VOzoe4jhLWxCDZsKwbuYRJgNLEk+ub9m7i7GkAHPQuZ QkgOJoJUuQe1f+MXqmL0NfUQ/SpP2EPHfScXP3MAbOROKnpM6YQshnUsj96sn+eFB8mB YLvc8IMNwuoxnVIuDH348E9q73tZsIaj5tBjlU9d2Kl5fbnmyXYgyZc7tCduuSZPUSA+ LDDD4kkyolaQhh6BqHyIwHE1PS6PKGWFYcTa+Jpb000lEMr99WQrbg5p/vLvuwUjGWca 7dcbIPYe9rLGtlDBjEqqJeofbjPi0X51xkYOX/Ij7arx+60rk22eCYp9Imj9pb2yd7eG RdSQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p70-v6si19500060pgp.53.2018.10.22.10.10.28; Mon, 22 Oct 2018 10:10:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728639AbeJWB3W (ORCPT + 99 others); Mon, 22 Oct 2018 21:29:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55846 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728481AbeJWB3W (ORCPT ); Mon, 22 Oct 2018 21:29:22 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 026B33082A26; Mon, 22 Oct 2018 17:10:02 +0000 (UTC) Received: from redhat.com (ovpn-125-63.rdu2.redhat.com [10.10.125.63]) by smtp.corp.redhat.com (Postfix) with SMTP id 48AE317F90; Mon, 22 Oct 2018 17:10:01 +0000 (UTC) Date: Mon, 22 Oct 2018 13:10:00 -0400 From: Don Zickus To: Jiri Olsa Cc: David Miller , acme@kernel.org, linux-kernel@vger.kernel.org Subject: Re: perf overlapping maps... Message-ID: <20181022171000.67rndl6br4fot7dm@redhat.com> References: <20181019.210549.1285253275146712779.davem@davemloft.net> <20181019.214401.2045294780943844999.davem@davemloft.net> <20181022140738.jvutwmstgm2f65et@redhat.com> <20181022161613.GF2945@krava> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181022161613.GF2945@krava> User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Mon, 22 Oct 2018 17:10:02 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 22, 2018 at 06:16:13PM +0200, Jiri Olsa wrote: > On Mon, Oct 22, 2018 at 10:07:38AM -0400, Don Zickus wrote: > > (adding Jiri) > > > > On Fri, Oct 19, 2018 at 09:44:01PM -0700, David Miller wrote: > > > From: David Miller > > > Date: Fri, 19 Oct 2018 21:05:49 -0700 (PDT) > > > > > > > One solution I've come up with is: > > > > > > > > 1) When synthesizing a fork event, set PERF_RECORD_MISC_COMM_EXEC in > > > > header->misc. > > > > > > > > 2) Use this to elide the map groups clone in > > > > thread__clone_map_groups(). > > > > > > Looking into code history, I notice: > > > > > > commit 363b785f3805a2632eb09a8b430842461c21a640 > > > Author: Don Zickus > > > Date: Fri Mar 14 10:43:44 2014 -0400 > > > > > > perf tools: Speed up thread map generation > > > > > > and the subsequent: > > > > > > commit 4aa5f4f7bb8bc41cba15bcd0d80c4fb085027d6b > > > Author: Arnaldo Carvalho de Melo > > > Date: Fri Feb 27 19:52:10 2015 -0300 > > > > > > perf tools: Fix FORK after COMM when synthesizing records for pre-existing threads > > > > > > If Don wanted to have the map cloning to happen for processes without > > > CLONE_VM, I'm not sure that's right. > > > > > > For real threads, we just take a reference to the map group from > > > the parent. > > > > > > Don, a quick summary. If we synthesize a fork event, let's say for an > > > emacs process. perf will clone the map groups of the parent bash > > > shell which invoked emacs. Via: > > > > > > thread__fork(thread, parent, timestamp) > > > { > > > ... > > > thread__clone_map_groups(thread, parent) > > > { > > > ... > > > map_groups__clone(thread, parent->mg) > > > > > > Which is completely bogus. It brings all of the bash process maps > > > into the emacs thread map group. Then we process the emacs mmap2 > > > events, which overlap the bash process maps already cloned into the > > > emacs map group. And this make all kinds of erroneous things happen. > > > > > > I'm suggesting to elide the map groups clone in this situation where > > > we are synthesizing the fork. > > right, this seems correct.. we should only clone parent maps > for kernel fork event, not when we synthesize.. I'll check > the solution you proposed and try to come with a patch Thanks Jiri for helping me out on this! Cheers, Don > > > > > Hi David, > > > > Honestly, I remember very little of this change other than we ran specjbb > > which created thousands of threads and we wanted a better way to handle that > > situation (waiting 15 minutes seemed wrong). > > > > Jiri Olsa is probably more knowledgable about this then I am these days and > > can work with Joe to re-do the test to verify any suggested changes does not > > break our intended use case. > > > > Thinking about it more, I am wondering if we did this because we ran the > > test and it takes about 20 minutes to 'warm up' then we attached perf to the > > test. This implies we had to handle the situation where 10K threads already > > existed hence our optimization. But I can be wrong. > > > > Your suggestion is probably right and I am sure we can reproduce the > > scenario to verify things didn't regress. > > I think the fix might actualy speed things up, > but yes, there could be other report regressions > > thanks, > jirka