summarylogtreecommitdiffstats
path: root/vmmon-14.0.0-4.13.3.patch
diff options
context:
space:
mode:
author张弘引2017-10-04 23:40:17 +0800
committer张弘引2017-10-04 23:40:17 +0800
commitf4f4c61067b129249136b7b19e048d76d9e05459 (patch)
treefc89ffb77ebdcd8f1a40a674db74072997aa016b /vmmon-14.0.0-4.13.3.patch
parent34468bb29eb613538bc180ef39a3ecf37fd54393 (diff)
downloadaur-f4f4c61067b129249136b7b19e048d76d9e05459.tar.gz
add support for Vmware Workstation 14.0.0
Diffstat (limited to 'vmmon-14.0.0-4.13.3.patch')
-rw-r--r--vmmon-14.0.0-4.13.3.patch62
1 files changed, 62 insertions, 0 deletions
diff --git a/vmmon-14.0.0-4.13.3.patch b/vmmon-14.0.0-4.13.3.patch
new file mode 100644
index 000000000000..756fa66fa3cc
--- /dev/null
+++ b/vmmon-14.0.0-4.13.3.patch
@@ -0,0 +1,62 @@
+diff --git a/vmmon-only/linux/hostif.c b/vmmon-only/linux/hostif.c
+--- vmmon-only/linux/hostif.c
++++ vmmon-only/linux/hostif.c
+@@ -99,6 +99,37 @@
+ #include "vmmonInt.h"
+ #include "versioned_atomic.h"
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0)
++#define global_zone_page_state global_page_state
++#endif
++
++static unsigned long get_nr_slab_unreclaimable(void)
++{
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0)
++ return global_node_page_state(NR_SLAB_UNRECLAIMABLE);
++#else
++ return global_page_state(NR_SLAB_UNRECLAIMABLE);
++#endif
++}
++
++static unsigned long get_nr_unevictable(void)
++{
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
++ return global_node_page_state(NR_UNEVICTABLE);
++#else
++ return global_page_state(NR_UNEVICTABLE);
++#endif
++}
++
++static unsigned long get_nr_anon_mapped(void)
++{
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
++ return global_node_page_state(NR_ANON_MAPPED);
++#else
++ return global_page_state(NR_ANON_PAGES);
++#endif
++}
++
+ /*
+ * Determine if we can use high resolution timers.
+ */
+@@ -1594,16 +1625,11 @@ HostIF_EstimateLockedPageLimit(const VMDriver* vm, // IN
+ unsigned int reservedPages = MEMDEFAULTS_MIN_HOST_PAGES;
+ unsigned int hugePages = (vm == NULL) ? 0 :
+ BYTES_2_PAGES(vm->memInfo.hugePageBytes);
+- unsigned int lockedPages = global_page_state(NR_PAGETABLE) +
+- global_page_state(NR_SLAB_UNRECLAIMABLE) +
+- global_page_state(NR_UNEVICTABLE) +
++ unsigned int lockedPages = global_zone_page_state(NR_PAGETABLE) +
++ get_nr_slab_unreclaimable() +
++ get_nr_unevictable() +
+ hugePages + reservedPages;
+- unsigned int anonPages =
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
+- global_page_state(NR_ANON_MAPPED);
+-#else
+- global_page_state(NR_ANON_PAGES);
+-#endif
++ unsigned int anonPages = get_nr_anon_mapped();
+ unsigned int swapPages = BYTES_2_PAGES(linuxState.swapSize);
+
+ if (anonPages > swapPages) {