Commit 3c5cb5e5 authored by John Barboza's avatar John Barboza Committed by Commit Bot

AIX: [Memory] Use madvise on POSIX to allow OS to reclaim memory.

Port 2cbfa244

Original Commit Message:

  [Memory] Use madvise on POSIX to allow OS to reclaim memory.

  - Use madvise when setting no permissions on memory.
  - Move platform specific mmap flag calculations to a helper fn.

  Bug: chromium:756050,chromium:788341
  Change-Id: I7d420a0abee9656a57fb0317301322da2fd7d7b5
  Reviewed-on: https://chromium-review.googlesource.com/790932


Change-Id: I5f7957066d0be96bd429b3d55c9293ffb996750c
Reviewed-on: https://chromium-review.googlesource.com/804554Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Reviewed-by: 's avatarBill Budge <bbudge@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49961}
parent 4c7f2d81
......@@ -137,6 +137,8 @@ int ReclaimInaccessibleMemory(void* address, size_t size) {
// marks the pages with the reusable bit, which allows both Activity Monitor
// and memory-infra to correctly track the pages.
int ret = madvise(address, size, MADV_FREE_REUSABLE);
#elif defined(_AIX)
int ret = madvise(reinterpret_cast<caddr_t>(address), size, MADV_FREE);
#else
int ret = madvise(address, size, MADV_FREE);
#endif
......@@ -144,7 +146,11 @@ int ReclaimInaccessibleMemory(void* address, size_t size) {
// MADV_FREE only works on Linux 4.5+ . If request failed, retry with older
// MADV_DONTNEED . Note that MADV_FREE being defined at compile time doesn't
// imply runtime support.
#if defined(_AIX)
ret = madvise(reinterpret_cast<caddr_t>(address), size, MADV_DONTNEED);
#else
ret = madvise(address, size, MADV_DONTNEED);
#endif
}
return ret;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment