Mac OS: Tag mapped pages.
This can be used to help profiling tools (e.g. vmmap) identify the sources of mappings more specifically.
This commit is contained in:
parent
f6699803e2
commit
35a8552605
12
configure.ac
12
configure.ac
@ -926,6 +926,18 @@ if test "x${je_cv_cold}" = "xyes" ; then
|
||||
AC_DEFINE([JEMALLOC_HAVE_ATTR_COLD], [ ])
|
||||
fi
|
||||
|
||||
dnl Check for VM_MAKE_TAG for mmap support.
|
||||
JE_COMPILABLE([vm_make_tag],
|
||||
[#include <sys/mman.h>
|
||||
#include <mach/vm_statistics.h>],
|
||||
[void *p;
|
||||
p = mmap(0, 16, PROT_READ, MAP_ANON|MAP_PRIVATE, VM_MAKE_TAG(1), 0);
|
||||
munmap(p, 16);],
|
||||
[je_cv_vm_make_tag])
|
||||
if test "x${je_cv_vm_make_tag}" = "xyes" ; then
|
||||
AC_DEFINE([JEMALLOC_HAVE_VM_MAKE_TAG], [ ])
|
||||
fi
|
||||
|
||||
dnl Support optional additions to rpath.
|
||||
AC_ARG_WITH([rpath],
|
||||
[AS_HELP_STRING([--with-rpath=<rpath>], [Colon-separated rpath (ELF systems only)])],
|
||||
|
@ -404,4 +404,7 @@
|
||||
/* Performs additional size checks when defined. */
|
||||
#undef JEMALLOC_OPT_SIZE_CHECKS
|
||||
|
||||
/* Darwin VM_MAKE_TAG support */
|
||||
#undef JEMALLOC_HAVE_VM_MAKE_TAG
|
||||
|
||||
#endif /* JEMALLOC_INTERNAL_DEFS_H_ */
|
||||
|
@ -16,6 +16,11 @@
|
||||
#ifdef __NetBSD__
|
||||
#include <sys/bitops.h> /* ilog2 */
|
||||
#endif
|
||||
#ifdef JEMALLOC_HAVE_VM_MAKE_TAG
|
||||
#define PAGES_FD_TAG VM_MAKE_TAG(101U)
|
||||
#else
|
||||
#define PAGES_FD_TAG -1
|
||||
#endif
|
||||
|
||||
/******************************************************************************/
|
||||
/* Data. */
|
||||
@ -141,7 +146,7 @@ os_pages_map(void *addr, size_t size, size_t alignment, bool *commit) {
|
||||
#endif
|
||||
int prot = *commit ? PAGES_PROT_COMMIT : PAGES_PROT_DECOMMIT;
|
||||
|
||||
ret = mmap(addr, size, prot, mmap_flags, -1, 0);
|
||||
ret = mmap(addr, size, prot, mmap_flags, PAGES_FD_TAG, 0);
|
||||
}
|
||||
assert(ret != NULL);
|
||||
|
||||
@ -326,7 +331,7 @@ pages_commit_impl(void *addr, size_t size, bool commit) {
|
||||
{
|
||||
int prot = commit ? PAGES_PROT_COMMIT : PAGES_PROT_DECOMMIT;
|
||||
void *result = mmap(addr, size, prot, mmap_flags | MAP_FIXED,
|
||||
-1, 0);
|
||||
PAGES_FD_TAG, 0);
|
||||
if (result == MAP_FAILED) {
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user