Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp3603364ybn; Fri, 27 Sep 2019 08:39:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqzZKecypsMJmB+6Gb0LQTh2C9S7L4Q31OE0hZTq5VDJKXH9Mdc+j7tbJWBl0tFopKpQxYip X-Received: by 2002:a17:906:a44e:: with SMTP id cb14mr8379397ejb.277.1569598778363; Fri, 27 Sep 2019 08:39:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569598778; cv=none; d=google.com; s=arc-20160816; b=KScrwnSTZNo8zApwA2Dz2vgcPGJuI0Jr+K4f0ylJKxqaVqv8YRKnShhSpBDFYpkhOq fXmL078Ek3mzmsE43LF8GYhcFyKB9rSujgzIhbsrtYZ1a/PHvK8U7JHlS+uzxV/RB7sk WkLNDMNEsN+Fx8D4Ew1YsjLqxojiW2tamToSSb3/7qTHIhZa3QpeNGpfNuNtgC9gfS5O mEYKwcZfFgUMJVSGpdTZo42/LBEhLfPfcogg5XNy+qUn0KahdD1WTMdvV67vXE9qu7/g iCxTF324Y9weocigge/JrL3olsxAZb8L9vLY9DL4lGDYj7K5gqXMT9a3tnJS4UlV2NPV xMQg== 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:date:from:dkim-signature; bh=OZJdrfl43OTXDprqzuszedX5xeC5q34acvcr4RIosmY=; b=l81nXx2NNEfNbH6ZT0mFx32aG8eD3J5T2TczFskLdV9ZXyb9eGd5ybTeo8QqJt7HTx NNE9FgQ+i/fOiXjWWX1XDme79/AR495j27nJSqPb7+ajqwLwgOPnLYqo5CNhbEpT8B0h WAijAzpsLn21Hbh9kI+tfe+HhXB4H+8dz4YzW6haGVaA6nzqwYUiJYCVuVHO+81IOf2m K6IyRkWdwWsyBdT/IP+lPPEfT9mGQMdaVn1ayf5ZrHI7wdmODKeihh7kIJihAcB4wlxC 6QuQTaqIpiH169TE1EgNRVq3Czo3gxsBY5pPqz9Ajp10oVAAoOifmT2iph25HsH6U9mv 4MOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=W7j1uVUe; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ck10si2931256ejb.181.2019.09.27.08.39.13; Fri, 27 Sep 2019 08:39:38 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=W7j1uVUe; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727809AbfI0Pfo (ORCPT + 99 others); Fri, 27 Sep 2019 11:35:44 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:42134 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727334AbfI0Pfo (ORCPT ); Fri, 27 Sep 2019 11:35:44 -0400 Received: by mail-qt1-f196.google.com with SMTP id w14so7766610qto.9 for ; Fri, 27 Sep 2019 08:35:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=OZJdrfl43OTXDprqzuszedX5xeC5q34acvcr4RIosmY=; b=W7j1uVUeseE0Bu0ye4U47s0Aa4/9MiPhWQB5N0jZPAVYdHR0o3voTLH8KIKqxpcEVW lWQxV28oyikJkCy9APIe7HyDUaJID+PcPVPdZMSkyd4orugPhzpsLR/jA+bWFKwDXWiP QfIiCHfoncKjZR3HC73w5HAb96/NWLjEEvUFY1Ow1OmbfXsPZi+32JKXzxXilTJraArz SmWEOCzMLPdOuDYqQFtMu06mvbjSWtwr2VZN/1bFUCo+h1jiC+3s6Z9lHo2XDTbgqzRY hk4I+ZCjD1Rx2cssb8h4T7fDyW5O6EtXLBZH0aRp2NjfXAOJqy/YDpTYeNzOl8EQX83C 7w7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=OZJdrfl43OTXDprqzuszedX5xeC5q34acvcr4RIosmY=; b=d7r3GuIBoCCYkLvc03u56jPnilx7FRr8F82CDrUEL3AkNvX0ixKRpiziyMJTrMl4dQ QhZYJTz1r0tJCtNag7ApwWpFpqVqff1rKw34yPhQUDeqppE8ahD9NwDlsHv69z/erYD4 lU77vjqYLQzsAv8etbM342/N08G52lYxRQl+IV+lZKKdOyeCVNruhtHujbkLPsNuaVIf a4Qo+FhZZ8znQk3XZxkxdvlpeyJoewLO2Bj7VzL0lzc1Mq5CkE0qFt+O6Fo0mShKSTKC MZBeU2NsazWkqRnDX0BuxlA9AOJE6czthvnnP+6TALXVHRYDMGxAKRHyrfm99mamgrO9 idqA== X-Gm-Message-State: APjAAAU49nNuVc+2wuu4izuTEQvLqYj/1zPDYebTW+eISv0XYZSMmeUc i2hhYvlTP878pffo+hYWpYM= X-Received: by 2002:ac8:3ff2:: with SMTP id v47mr10718124qtk.15.1569598543170; Fri, 27 Sep 2019 08:35:43 -0700 (PDT) Received: from quaco.ghostprotocols.net ([179.97.35.50]) by smtp.gmail.com with ESMTPSA id a14sm1472689qkg.59.2019.09.27.08.35.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Sep 2019 08:35:42 -0700 (PDT) From: Arnaldo Carvalho de Melo X-Google-Original-From: Arnaldo Carvalho de Melo Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 4B99340396; Fri, 27 Sep 2019 12:35:40 -0300 (-03) Date: Fri, 27 Sep 2019 12:35:40 -0300 To: Steve MacLean Cc: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Changbin Du , Eric Saint-Etienne , John Keeping , Andi Kleen , Song Liu , Davidlohr Bueso , Leo Yan , "linux-kernel@vger.kernel.org" , Brian Robbins , Tom McDonald , John Salem Subject: Re: [PATCH] perf map: fix overlapped map handling Message-ID: <20190927153540.GB20644@kernel.org> References: <20190920193852.GI4865@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Fri, Sep 20, 2019 at 09:46:15PM +0000, Steve MacLean escreveu: > >> after->start = map->end; > >> + after->pgoff = pos->map_ip(pos, map->end); > > > > So is this equivalent to what __split_vma() does in the kernel, i.e.: > > > > if (new_below) > > new->vm_end = addr; > > else { > > new->vm_start = addr; > > new->vm_pgoff += ((addr - vma->vm_start) >> PAGE_SHIFT); > > } > > > > where new->vm_pgoff starts equal to the vm_pgoff of the mmap being split? > > It is roughly equivalent. The pgoff in struct map is stored in bytes not in pages, so it doesn't include the shift. > > An earlier version of this patch used: > after->start = map->end; > + after->pgoff += map->end - pos->start; > > Instead of the newer Functionally equivalent: > after->start = map->end; > + after->pgoff = pos->map_ip(pos, map->end); > > I preferred the latter form as it made more sense with the assertion that the mapping of map->end should match in pos and after. Sorry for the delay in continuing with this discussion, I was at Plumbers in Lisbon and then some vacations, etc. Also I was hoping someone else would jump here and provide some Reviewed-by tag, etc :-) So, if they are equivalent then I think its better to use code that ressembles the kernel as much as possible, so that when in doubt we can compare the tools/perf calcs with how the kernel does it, filtering out things like the PAGE_SHIFT, can we go that way? Also do you have some reproducer, if you have one then we can try and have this as a 'perf test' entry, bolting some more checks into tools/perf/tests/perf-record.c or using it as a start for a test that stresses this code. This is not a prerequisite for having your fix on, but would help checking that perf doesn't regresses in this area. - Arnaldo