Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b8807f6cfb | ||
|
|
011adf5497 | ||
|
|
7e3a534e61 | ||
|
|
82f569a212 | ||
|
|
455d4d9368 | ||
|
|
027dd56418 | ||
|
|
0e634ffbf1 | ||
|
|
c62c78e908 | ||
|
|
4f648692e4 |
No files matched your search
@@ -35,8 +35,6 @@
|
||||
#define INCLUDE_ALLOW_VMCORE
|
||||
#include "includeCheck.h"
|
||||
|
||||
#include <asm/processor-flags.h>
|
||||
|
||||
#define X86_MAX_INSTR_LEN 15 /* Max byte length of an x86 instruction. */
|
||||
|
||||
#define NUM_IDT_VECTORS 256
|
||||
@@ -77,9 +75,7 @@
|
||||
#define CR3_PDB_MASK 0xfffff000
|
||||
#define CR3_IGNORE 0xFFF
|
||||
#define PAE_CR3_IGNORE 0x1F
|
||||
#ifndef CR3_PCID_MASK
|
||||
#define CR3_PCID_MASK 0xFFF
|
||||
#endif
|
||||
#define CR3_NO_FLUSH (1ULL << 63)
|
||||
|
||||
#define CR4_VME 0x00000001
|
||||
|
||||
+27
-36
@@ -79,37 +79,6 @@
|
||||
#error CONFIG_HIGH_RES_TIMERS required for acceptable performance
|
||||
#endif
|
||||
|
||||
#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
|
||||
}
|
||||
|
||||
/*
|
||||
* Although this is not really related to kernel-compatibility, I put this
|
||||
* helper macro here for now for a lack of better place --hpreg
|
||||
@@ -1547,13 +1516,35 @@ 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_zone_page_state(NR_PAGETABLE) +
|
||||
get_nr_slab_unreclaimable() +
|
||||
get_nr_unevictable() +
|
||||
hugePages + reservedPages;
|
||||
unsigned int anonPages = get_nr_anon_mapped();
|
||||
unsigned int lockedPages = hugePages + reservedPages;
|
||||
unsigned int anonPages;
|
||||
unsigned int swapPages = BYTES_2_PAGES(linuxState.swapSize);
|
||||
|
||||
/* global_page_state is global_zone_page_state in 4.14. */
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
|
||||
lockedPages += global_zone_page_state(NR_PAGETABLE);
|
||||
#else
|
||||
lockedPages += global_page_state(NR_PAGETABLE);
|
||||
#endif
|
||||
/* NR_SLAB_* moved from zone to node in 4.13. */
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0)
|
||||
lockedPages += global_node_page_state(NR_SLAB_UNRECLAIMABLE);
|
||||
#else
|
||||
lockedPages += global_page_state(NR_SLAB_UNRECLAIMABLE);
|
||||
#endif
|
||||
/* NR_UNEVICTABLE moved from global to node in 4.8. */
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
|
||||
lockedPages += global_node_page_state(NR_UNEVICTABLE);
|
||||
#else
|
||||
lockedPages += global_page_state(NR_UNEVICTABLE);
|
||||
#endif
|
||||
/* NR_ANON_MAPPED moved & changed name in 4.8. */
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
|
||||
anonPages = global_node_page_state(NR_ANON_MAPPED);
|
||||
#else
|
||||
anonPages = global_page_state(NR_ANON_PAGES);
|
||||
#endif
|
||||
|
||||
if (anonPages > swapPages) {
|
||||
lockedPages += anonPages - swapPages;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
INCLUDE := -I$(SRCROOT)
|
||||
|
||||
EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE)
|
||||
EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/netif_trans_update.c,-DVMW_NETIF_TRANS_UPDATE, )
|
||||
|
||||
obj-m += $(DRIVER).o
|
||||
|
||||
|
||||
@@ -337,9 +337,7 @@ typedef netdev_features_t compat_netdev_features_t;
|
||||
typedef u32 compat_netdev_features_t;
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) || \
|
||||
(defined(RHEL_RELEASE_CODE) && RHEL_RELEASE_CODE >= 0x0704) || \
|
||||
(defined(CONFIG_SUSE_KERNEL) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 73))
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) || defined(VMW_NETIF_TRANS_UPDATE)
|
||||
#define compat_netif_trans_update(d) netif_trans_update(d)
|
||||
#else
|
||||
#define compat_netif_trans_update(d) do { (d)->trans_start = jiffies; } while (0)
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/*********************************************************
|
||||
* Copyright (C) 2017 VMware, Inc. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation version 2 and no later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*********************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* Detect whether there is netif_trans_update, which got introduced from 4.7.0
|
||||
* Older kernels may have this function backported by vendors.
|
||||
*/
|
||||
|
||||
#include "compat_version.h"
|
||||
#include "compat_autoconf.h"
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
|
||||
# error This compile test intentionally fails.
|
||||
#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0)
|
||||
#include <linux/netdevice.h>
|
||||
|
||||
void test_netif_trans_update(struct net_device *dev)
|
||||
{
|
||||
netif_trans_update(dev);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user