Revert "Use MADV_FREE to reclaim pages of freed regions"

This reverts commit 315f1b21a51a67e5d9c9ec3a04f1887931061e10.

Reason for revert: Regression in PSS (b/155678984). Also MPTS test report a low hit ratio (20%), which doesn't justify the change, at least in the current format. A workaround will be to bring back marking pages back and only madv_free first few regions which are expected to be allocated soon. The rest of the regions should probably be reclaimed with MADV_DONTNEED. Also, for a GC happening when the app is in background should probably reclaim all regions with MADV_DONTNEED.

Test: art/test/testrunner/testrunner.py
Bug: 155678984
Bug: 74447417
Bug: 140130889
Change-Id: I3c4bc4648a3b12062957a51ee716742eb9944747
diff --git a/libartbase/base/membarrier.cc b/libartbase/base/membarrier.cc
index d925049..48f47df 100644
--- a/libartbase/base/membarrier.cc
+++ b/libartbase/base/membarrier.cc
@@ -21,6 +21,7 @@
 
 #if !defined(_WIN32)
 #include <sys/syscall.h>
+#include <sys/utsname.h>
 #include <unistd.h>
 #endif
 #include "macros.h"
@@ -28,7 +29,6 @@
 #if defined(__BIONIC__)
 
 #include <atomic>
-#include <base/utils.h>
 #include <linux/membarrier.h>
 
 #define CHECK_MEMBARRIER_CMD(art_value, membarrier_value) \
@@ -49,7 +49,14 @@
 
 int membarrier(MembarrierCommand command) {
   // Check kernel version supports membarrier(2).
-  if (KernelVersionLower(4, 16)) {
+  static constexpr int kRequiredMajor = 4;
+  static constexpr int kRequiredMinor = 16;
+  struct utsname uts;
+  int major, minor;
+  if (uname(&uts) != 0 ||
+      strcmp(uts.sysname, "Linux") != 0 ||
+      sscanf(uts.release, "%d.%d", &major, &minor) != 2 ||
+      (major < kRequiredMajor || (major == kRequiredMajor && minor < kRequiredMinor))) {
     errno = ENOSYS;
     return -1;
   }