Fix performance problem in long-running SectionMemoryManagers
authorKeno Fischer <kfischer@college.harvard.edu>
Thu, 1 Oct 2015 02:45:07 +0000 (02:45 +0000)
committerKeno Fischer <kfischer@college.harvard.edu>
Thu, 1 Oct 2015 02:45:07 +0000 (02:45 +0000)
commit2eee2e2c5e93bfa53106333908a769e164f5f58a
treee6cd247d1c3d8e41d99bf022f019c16c01a2d76c
parent32dcf8b8e9a1697f7f72490927ccc009d25920e0
Fix performance problem in long-running SectionMemoryManagers

Summary:
Without this patch, the memory manager would call `mprotect` on every memory
region it ever allocated whenever it wanted to finalize memory (i.e. not just
the ones it just allocated). This caused terrible performance problems for
long running memory managers. In one particular compile heavy julia benchmark,
we were spending 50% of time in `mprotect` if running under MCJIT.

Fix this by splitting allocated memory blocks into those on which memory
permissions have been set and those on which they haven't and only running
`mprotect` on the latter.

Reviewers: lhames

Subscribers: reames, llvm-commits

Differential Revision: http://reviews.llvm.org/D13156

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248981 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/ExecutionEngine/SectionMemoryManager.h
lib/ExecutionEngine/SectionMemoryManager.cpp