diff options
author | Jason Evans <jasone@canonware.com> | 2016-05-06 00:45:02 (GMT) |
---|---|---|
committer | Jason Evans <jasone@canonware.com> | 2016-05-06 01:56:17 (GMT) |
commit | c2f970c32b527660a33fa513a76d913c812dcf7c (patch) | |
tree | b0593fac905797fa543ac77aa5ebd9e1160cb67f /include/jemalloc | |
parent | dc391adc6577b4ed0dac0ce3b1778473e67e4c17 (diff) | |
download | jemalloc-c2f970c32b527660a33fa513a76d913c812dcf7c.zip jemalloc-c2f970c32b527660a33fa513a76d913c812dcf7c.tar.gz jemalloc-c2f970c32b527660a33fa513a76d913c812dcf7c.tar.bz2 |
Modify pages_map() to support mapping uncommitted virtual memory.
If the OS overcommits:
- Commit all mappings in pages_map() regardless of whether the caller
requested committed memory.
- Linux-specific: Specify MAP_NORESERVE to avoid
unfortunate interactions with heuristic overcommit mode during
fork(2).
This resolves #193.
Diffstat (limited to 'include/jemalloc')
-rw-r--r-- | include/jemalloc/internal/jemalloc_internal_defs.h.in | 9 | ||||
-rw-r--r-- | include/jemalloc/internal/pages.h | 5 | ||||
-rw-r--r-- | include/jemalloc/internal/private_symbols.txt | 1 |
3 files changed, 13 insertions, 2 deletions
diff --git a/include/jemalloc/internal/jemalloc_internal_defs.h.in b/include/jemalloc/internal/jemalloc_internal_defs.h.in index 2c75371..7de0cf7 100644 --- a/include/jemalloc/internal/jemalloc_internal_defs.h.in +++ b/include/jemalloc/internal/jemalloc_internal_defs.h.in @@ -215,6 +215,15 @@ #undef JEMALLOC_ZONE_VERSION /* + * Methods for determining whether the OS overcommits. + * JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY: Linux's + * /proc/sys/vm.overcommit_memory file. + * JEMALLOC_SYSCTL_VM_OVERCOMMIT: FreeBSD's vm.overcommit sysctl. + */ +#undef JEMALLOC_SYSCTL_VM_OVERCOMMIT +#undef JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY + +/* * Methods for purging unused pages differ between operating systems. * * madvise(..., MADV_DONTNEED) : On Linux, this immediately discards pages, diff --git a/include/jemalloc/internal/pages.h b/include/jemalloc/internal/pages.h index da7eb96..e21effd 100644 --- a/include/jemalloc/internal/pages.h +++ b/include/jemalloc/internal/pages.h @@ -9,13 +9,14 @@ /******************************************************************************/ #ifdef JEMALLOC_H_EXTERNS -void *pages_map(void *addr, size_t size); +void *pages_map(void *addr, size_t size, bool *commit); void pages_unmap(void *addr, size_t size); void *pages_trim(void *addr, size_t alloc_size, size_t leadsize, - size_t size); + size_t size, bool *commit); bool pages_commit(void *addr, size_t size); bool pages_decommit(void *addr, size_t size); bool pages_purge(void *addr, size_t size); +void pages_boot(void); #endif /* JEMALLOC_H_EXTERNS */ /******************************************************************************/ diff --git a/include/jemalloc/internal/private_symbols.txt b/include/jemalloc/internal/private_symbols.txt index 7958a4f..0f9b99e 100644 --- a/include/jemalloc/internal/private_symbols.txt +++ b/include/jemalloc/internal/private_symbols.txt @@ -398,6 +398,7 @@ opt_utrace opt_xmalloc opt_zero p2rz +pages_boot pages_commit pages_decommit pages_map |