Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932236AbcLLItT (ORCPT ); Mon, 12 Dec 2016 03:49:19 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:43815 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932115AbcLLItS (ORCPT ); Mon, 12 Dec 2016 03:49:18 -0500 Date: Mon, 12 Dec 2016 09:49:03 +0100 From: Peter Zijlstra To: Andres Freund Cc: linux-kernel@vger.kernel.org, Stephane Eranian , acme@kernel.org, jolsa@redhat.com, mingo@elte.hu, anton@ozlabs.org, namhyung@kernel.org, Stephane Eranian Subject: Re: perf/jit doesn't cope well with mprotect() to jit containing pages Message-ID: <20161212084903.GZ3124@twins.programming.kicks-ass.net> References: <20161210050218.jw4bak5jf766iqpb@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161210050218.jw4bak5jf766iqpb@alap3.anarazel.de> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 879 Lines: 26 On Fri, Dec 09, 2016 at 09:02:18PM -0800, Andres Freund wrote: > > I presume the increasing MMAP2 size is triggered by the consecutive > pages being represented as a single page-range in the kernel? Yes, we print struct vm_area_struct based information, if vmas get merged, that shows. > If I, to work around such consecutive pages, force another page to be > mmap()ed inbetween, and avoid using MAP_ANONYMOUS, the problem also goes > away. This would indeed inhibit vma merging. > Am I doing something wrong, or is there a bug here? Expected behaviour afaict > BTW, it's also a bit weird that those MMAP2 records triggered by > mprotect/mmap, have prot set to 0... Yes, mprotect() does: vma->vm_flags = newflags; before calling perf_event_mmap(vma); which then looks at VM_{READ,WRITE,EXEC} bits in that word to generate the prot value. So that being 0 is a bit weird.