summaryrefslogtreecommitdiffstats
path: root/chromium/build/patches/chromium_madv_free.patch
blob: b06627ffe4f0c59fba7da7c59e951b5cd9eb9fd4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Taken from Gentoo:
https://gitweb.gentoo.org/repo/gentoo.git/tree/www-client/chromium/files/chromium-glibc-2.24.patch

--- a/third_party/WebKit/Source/wtf/allocator/PageAllocator.cpp.orig	2017-01-05 20:50:56.329369189 +0000
+++ b/third_party/WebKit/Source/wtf/allocator/PageAllocator.cpp	2017-01-05 20:51:32.926099779 +0000
@@ -242,6 +242,12 @@
   ASSERT(!(len & kSystemPageOffsetMask));
 #if 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);
+  }
   RELEASE_ASSERT(!ret);
 #else
   setSystemPagesInaccessible(addr, len);