| Index: base/allocator/partition_allocator/page_allocator.cc
|
| diff --git a/base/allocator/partition_allocator/page_allocator.cc b/base/allocator/partition_allocator/page_allocator.cc
|
| index 9678488e340e30e78daf86f88a1601b51fd81c0d..5b1ef8ba2f8b1993be61ab7565b1122f5003d47f 100644
|
| --- a/base/allocator/partition_allocator/page_allocator.cc
|
| +++ b/base/allocator/partition_allocator/page_allocator.cc
|
| @@ -216,6 +216,12 @@ void decommitSystemPages(void* addr, size_t len) {
|
| DCHECK(!(len & kSystemPageOffsetMask));
|
| #if defined(OS_POSIX)
|
| int ret = madvise(addr, len, MADV_FREE);
|
| + if (ret != 0 && errno == EINVAL) {
|
| + // 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.
|
| + ret = madvise(addr, len, MADV_DONTNEED);
|
| + }
|
| CHECK(!ret);
|
| #else
|
| setSystemPagesInaccessible(addr, len);
|
|
|