Re: perf/jit doesn't cope well with mprotect() to jit containing pages
From: Peter Zijlstra
Date: Mon Dec 12 2016 - 03:49:21 EST
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.