summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/amd64/amd64/machdep.c7
-rw-r--r--sys/i386/i386/machdep.c7
2 files changed, 10 insertions, 4 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index fab3111..e9d160f 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -1401,10 +1401,13 @@ getmemsize(caddr_t kmdp, u_int64_t first)
Maxmem = atop(physmem_tunable);
/*
- * By default keep the memtest enabled. Use a general name so that
+ * By default enable the memory test on real hardware, and disable
+ * it if we appear to be running in a VM. This avoids touching all
+ * pages unnecessarily, which doesn't matter on real hardware but is
+ * bad for shared VM hosts. Use a general name so that
* one could eventually do more with the code than just disable it.
*/
- memtest = 1;
+ memtest = (vm_guest > VM_GUEST_NO) ? 0 : 1;
TUNABLE_ULONG_FETCH("hw.memtest.tests", &memtest);
/*
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
index c7352d9..e481e22 100644
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/machdep.c
@@ -2369,10 +2369,13 @@ physmap_done:
Maxmem = atop(physmap[physmap_idx + 1]);
/*
- * By default keep the memtest enabled. Use a general name so that
+ * By default enable the memory test on real hardware, and disable
+ * it if we appear to be running in a VM. This avoids touching all
+ * pages unnecessarily, which doesn't matter on real hardware but is
+ * bad for shared VM hosts. Use a general name so that
* one could eventually do more with the code than just disable it.
*/
- memtest = 1;
+ memtest = (vm_guest > VM_GUEST_NO) ? 0 : 1;
TUNABLE_ULONG_FETCH("hw.memtest.tests", &memtest);
if (atop(physmap[physmap_idx + 1]) != Maxmem &&
OpenPOWER on IntegriCloud