Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp211458imm; Fri, 19 Oct 2018 21:45:47 -0700 (PDT) X-Google-Smtp-Source: ACcGV63LiQB4kMyskKM38JD5EUdaVL9Bqy0RjG5+XChVrsSICPGaP/qNCRqtbZNWg/ScrWe2KZdM X-Received: by 2002:a63:2323:: with SMTP id j35-v6mr35432523pgj.337.1540010747876; Fri, 19 Oct 2018 21:45:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540010747; cv=none; d=google.com; s=arc-20160816; b=lvY9ZNs4NBcs8bFqKsCRjXjOsBb4b0395F2RB8vflF65pCZaC9sV03iqVZ8MCFIpT1 KK/yLgPECwiSLkAHV2oyF5F7tR7zrNdFfNycZ6FQRViSNuldxJDcQBq3xDc0HMQTP+ro 58e0ZAN8I9Q28PzN6Pfy5MKRpX6e0kPfABkNqcFL8/rBJCUN2vr3mfCrdkb4+7tpVJBs Tt/rqtRjXuEVJp8r7Q3+rDAvfAmLrTBkRF+YJKreQoPpJOTtJq/ZC/sidlJo/SgAzJ1X 2fsLvhBLpSTrml4Vfia/bpnJ3gNjsSRAa4wKcoIHl0XxGqzbqYa3EC52SOpbMOer2zAm yFdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date; bh=bZRCkIYoMgTXB+sQcpgG+3WuZ+02OJZdFRY6nx3LOU4=; b=SCRQyRu6CXOTrd6NrnMSMZDoeCqaQCycCUi7yyprARfKAdY2nKdDx8JHRzvK1PxpzU zvyI0HKpEMVz3EZVXUq0C4CWsvI4kDvlGokOP/ztNNsiozQLvj5uZjiS2CzouhJwzpSt PNliA/tRVC35qO3n2EYsLjr0Ul5UDFy/VLu7EcV99Q/6Jbl7yNr54zboPZVJFzI5vOS3 qZP5sosa0bc1WrpdV6PQE3IXeeriHDu3JkhxBxvD9XxBNq+HmWEwSor6fZzoxdjCMrG0 7pBuUflY9a8+gVaUWujjJ17M8QOs8F4XVJijKjOk+zbkH1Fm7j/JG7S9u6fjTEtrCMWI vw4Q== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 64-v6si70886plk.58.2018.10.19.21.44.56; Fri, 19 Oct 2018 21:45:47 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726642AbeJTMxK (ORCPT + 99 others); Sat, 20 Oct 2018 08:53:10 -0400 Received: from shards.monkeyblade.net ([23.128.96.9]:53762 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726463AbeJTMxK (ORCPT ); Sat, 20 Oct 2018 08:53:10 -0400 Received: from localhost (c-67-183-62-245.hsd1.wa.comcast.net [67.183.62.245]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id F37331262C5D2; Fri, 19 Oct 2018 21:44:04 -0700 (PDT) Date: Fri, 19 Oct 2018 21:44:01 -0700 (PDT) Message-Id: <20181019.214401.2045294780943844999.davem@davemloft.net> To: acme@kernel.org Cc: linux-kernel@vger.kernel.org, dzickus@redhat.com Subject: Re: perf overlapping maps... From: David Miller In-Reply-To: <20181019.210549.1285253275146712779.davem@davemloft.net> References: <20181019.210549.1285253275146712779.davem@davemloft.net> X-Mailer: Mew version 6.7 on Emacs 26 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Fri, 19 Oct 2018 21:44:05 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thanks.