commit:     f1e55c55662305fc41f64d9bbb074a28ed5a462c
Author:     Fabio Rossi <rossi.f <AT> inwind <DOT> it>
AuthorDate: Fri Nov  3 23:16:27 2017 +0000
Commit:     Fabio Rossi <rossi.f <AT> inwind <DOT> net>
CommitDate: Fri Nov  3 23:16:27 2017 +0000
URL:        https://gitweb.gentoo.org/proj/vmware.git/commit/?id=f1e55c55

app-emulation/vmware-modules: fix page accounting

Found a possibile problem with future vmware v14 products, at a certain point a
virtual machine remains without memory. See for example:

https://communities.vmware.com/thread/573281
https://superuser.com/questions/1255099/vmware-workstation-not-enough-physical-memory-since-last-update/1255963

To solve the issue I have inserted three of the patches available from
https://github.com/mkubecek/vmware-host-modules/commit/b50848c985f1
Thanks to mkubecek.

 .../files/308-4.08-00-vmmon-fix-page-accounting.patch | 19 +++++++++++++++++++
 .../files/308-4.13-01-vmmon-fix-page-accounting.patch | 14 ++++++++++++++
 .../vmware-modules/vmware-modules-308.5.7.ebuild      |  2 ++
 3 files changed, 35 insertions(+)

diff --git 
a/app-emulation/vmware-modules/files/308-4.08-00-vmmon-fix-page-accounting.patch
 
b/app-emulation/vmware-modules/files/308-4.08-00-vmmon-fix-page-accounting.patch
new file mode 100644
index 0000000..7d653f4
--- /dev/null
+++ 
b/app-emulation/vmware-modules/files/308-4.08-00-vmmon-fix-page-accounting.patch
@@ -0,0 +1,19 @@
+--- vmmon-only/linux/hostif.c  2017-10-26 00:01:58.466448868 +0200
++++ vmmon-only/linux/hostif.c.new      2017-10-26 00:10:42.874478191 +0200
+@@ -1597,11 +1597,15 @@
+       BYTES_2_PAGES(vm->memInfo.hugePageBytes);
+    unsigned int lockedPages = global_page_state(NR_PAGETABLE) +
+                               global_page_state(NR_SLAB_UNRECLAIMABLE) +
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
++                              global_node_page_state(NR_UNEVICTABLE) +
++#else
+                               global_page_state(NR_UNEVICTABLE) +
++#endif
+                               hugePages + reservedPages;
+    unsigned int anonPages =
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
+-      global_page_state(NR_ANON_MAPPED);
++      global_node_page_state(NR_ANON_MAPPED);
+ #else
+       global_page_state(NR_ANON_PAGES);
+ #endif

diff --git 
a/app-emulation/vmware-modules/files/308-4.13-01-vmmon-fix-page-accounting.patch
 
b/app-emulation/vmware-modules/files/308-4.13-01-vmmon-fix-page-accounting.patch
new file mode 100644
index 0000000..050a828
--- /dev/null
+++ 
b/app-emulation/vmware-modules/files/308-4.13-01-vmmon-fix-page-accounting.patch
@@ -0,0 +1,14 @@
+--- vmmon-only/linux/hostif.c  2017-10-26 00:16:39.496498131 +0200
++++ vmmon-only/linux/hostif.c.new      2017-10-26 00:20:35.154511309 +0200
+@@ -1596,7 +1596,11 @@
+    unsigned int hugePages = (vm == NULL) ? 0 :
+       BYTES_2_PAGES(vm->memInfo.hugePageBytes);
+    unsigned int lockedPages = global_page_state(NR_PAGETABLE) +
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0)
++                              global_node_page_state(NR_SLAB_UNRECLAIMABLE) +
++#else
+                               global_page_state(NR_SLAB_UNRECLAIMABLE) +
++#endif
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
+                               global_node_page_state(NR_UNEVICTABLE) +
+ #else

diff --git a/app-emulation/vmware-modules/vmware-modules-308.5.7.ebuild 
b/app-emulation/vmware-modules/vmware-modules-308.5.7.ebuild
index d7ebd9f..8987a1d 100644
--- a/app-emulation/vmware-modules/vmware-modules-308.5.7.ebuild
+++ b/app-emulation/vmware-modules/vmware-modules-308.5.7.ebuild
@@ -102,6 +102,7 @@ src_prepare() {
        kernel_is ge 4 5 0 && epatch 
"${FILESDIR}/${PV_MAJOR}-4.05-00-vmblock-follow_link.patch"
        kernel_is ge 4 6 0 && epatch 
"${FILESDIR}/${PV_MAJOR}-4.06-00-user-pages.patch"
        kernel_is ge 4 7 0 && epatch 
"${FILESDIR}/${PV_MAJOR}-4.07-01-readlink_copy.patch"
+       kernel_is ge 4 8 0 && epatch 
"${FILESDIR}/${PV_MAJOR}-4.08-00-vmmon-fix-page-accounting.patch"
        kernel_is ge 4 9 0 && epatch 
"${FILESDIR}/${PV_MAJOR}-4.09-00-user-pages.patch"
        kernel_is ge 4 10 0 && epatch 
"${FILESDIR}/${PV_MAJOR}-4.10-00-generic_readlink.patch"
        kernel_is ge 4 11 0 && epatch 
"${FILESDIR}/${PV_MAJOR}-4.11-00-missing-headers.patch"
@@ -110,6 +111,7 @@ src_prepare() {
        kernel_is ge 4 12 0 && epatch 
"${FILESDIR}/${PV_MAJOR}-4.12-01-vmci-do_once.patch"
        kernel_is ge 4 12 0 && epatch 
"${FILESDIR}/${PV_MAJOR}-4.12-02-vmci-pci_enable_msix.patch"
        kernel_is ge 4 13 0 && epatch 
"${FILESDIR}/${PV_MAJOR}-4.13-00-vmnet-refcount.patch"
+       kernel_is ge 4 13 0 && epatch 
"${FILESDIR}/${PV_MAJOR}-4.13-01-vmmon-fix-page-accounting.patch"
 
        # Allow user patches so they can support RC kernels and whatever else
        epatch_user

Reply via email to