diff options
| author | Bryan Cantrill <bryan@joyent.com> | 2015-02-27 09:27:51 +0000 |
|---|---|---|
| committer | Bryan Cantrill <bryan@joyent.com> | 2015-02-27 09:27:51 +0000 |
| commit | 0129dd03859042a25d83afd4884dd9a20928b757 (patch) | |
| tree | 8ee042d7f1694975be3b8fe0092608b52e61db42 /usr/src | |
| parent | 57c01905d7d5151f77e69cc05a7d8dabb15d1741 (diff) | |
| download | illumos-joyent-0129dd03859042a25d83afd4884dd9a20928b757.tar.gz | |
OS-3711 lxbrand plex dying in jemalloc
Diffstat (limited to 'usr/src')
| -rw-r--r-- | usr/src/lib/brand/lx/lx_brand/common/mem.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/usr/src/lib/brand/lx/lx_brand/common/mem.c b/usr/src/lib/brand/lx/lx_brand/common/mem.c index d5a8b14bef..ee53ba6269 100644 --- a/usr/src/lib/brand/lx/lx_brand/common/mem.c +++ b/usr/src/lib/brand/lx/lx_brand/common/mem.c @@ -230,8 +230,25 @@ lx_madvise(uintptr_t start, uintptr_t len, uintptr_t advice) case MADV_RANDOM: case MADV_SEQUENTIAL: case MADV_WILLNEED: - case MADV_DONTNEED: case MADV_FREE: + case MADV_DONTNEED: + if (advice == MADV_DONTNEED) { + /* + * On Linux, MADV_DONTNEED implies an immediate purge + * of the specified region. This is spuriously + * different from (nearly) every other Unix, having + * apparently been done to mimic the semantics on + * Digital Unix (!). This is bad enough (MADV_FREE + * both has better semantics and results in better + * performance), but it gets worse: Linux applications + * (and notably, jemalloc) have managed to depend on + * the busted semantics of MADV_DONTNEED on Linux. We + * implement these semantics via MADV_PURGE -- and + * we translate our advice accordingly. + */ + advice = MADV_PURGE; + } + ret = madvise((void *)start, len, advice); if (ret == -1) { if (errno == EBUSY) |
