[issue1776] vm_zeroidle: Detect movnti and enable bzeront if it is available
Venkatesh Srinivas (via DragonFly issue tracker)
sinknull at leaf.dragonflybsd.org
Sat May 29 06:44:03 PDT 2010
New submission from Venkatesh Srinivas <me at acm.jhu.edu>:
diff --git a/sys/platform/pc32/isa/npx.c b/sys/platform/pc32/isa/npx.c
index 1516315..8f60077 100644
--- a/sys/platform/pc32/isa/npx.c
+++ b/sys/platform/pc32/isa/npx.c
@@ -153,6 +153,8 @@ static void fpurstor (union savefpu *);
int hw_float; /* XXX currently just alias for npx_exists */
+extern int bzeront_avail;
+
SYSCTL_INT(_hw,HW_FLOATINGPT, floatingpoint,
CTLFLAG_RD, &hw_float, 0,
"Floatingpoint instructions executed in hardware");
@@ -492,6 +494,9 @@ npx_attach(device_t dev)
/* XXX */
}
}
+
+ if ((cpu_feature & CPUID_MMX) && (cpu_feature & CPUID_SSE) && mmxopt)
+ bzeront_avail = 1;
#endif
#if 0
if (cpu_class == CPUCLASS_586 && npx_ex16 && npx_exists &&
diff --git a/sys/platform/pc64/isa/npx.c b/sys/platform/pc64/isa/npx.c
index 58a085b..666b495 100644
--- a/sys/platform/pc64/isa/npx.c
+++ b/sys/platform/pc64/isa/npx.c
@@ -154,6 +154,8 @@ static void fpurstor (union savefpu *);
int hw_float; /* XXX currently just alias for npx_exists */
+extern int bzeront_avail;
+
SYSCTL_INT(_hw,HW_FLOATINGPT, floatingpoint,
CTLFLAG_RD, &hw_float, 0,
"Floatingpoint instructions executed in hardware");
@@ -492,6 +494,9 @@ npx_attach(device_t dev)
/* XXX */
}
}
+
+ if ((cpu_feature & CPUID_MMX) && (cpu_feature & CPUID_SSE) && mmxopt)
+ bzeront_avail = 1;
#endif
#if 0
if (cpu_class == CPUCLASS_586 && npx_ex16 && npx_exists &&
diff --git a/sys/vm/vm_zeroidle.c b/sys/vm/vm_zeroidle.c
index 02a7515..590b016 100644
--- a/sys/vm/vm_zeroidle.c
+++ b/sys/vm/vm_zeroidle.c
@@ -72,6 +72,7 @@ SYSCTL_INT(_vm, OID_AUTO, idlezero_enable, CTLFLAG_RW,
&idlezero_enable, 0,
static int idlezero_rate = NPAGES_RUN;
SYSCTL_INT(_vm, OID_AUTO, idlezero_rate, CTLFLAG_RW, &idlezero_rate, 0,
"Maximum pages per second to zero");
+int bzeront_avail = 0;
static int idlezero_nocache = 0;
SYSCTL_INT(_vm, OID_AUTO, idlezero_nocache, CTLFLAG_RW, &idlezero_nocache, 0,
"Maximum pages per second to zero");
@@ -218,6 +219,8 @@ pagezero_start(void __unused *arg)
int error;
struct thread *td;
+ idlezero_nocache = bzeront_avail;
+
error = kthread_create(vm_pagezero, NULL, &td, "pagezero");
if (error)
panic("pagezero_start: error %d\n", error);
================================
This patch detects the presence of SSE and accordingly enables
vm.idlezero_nocache. Only on pc32 and pc64 for the moment, not on the vkernels.
Tested on i386 (both with and without movnti) and in qemu.
-- vs
----------
messages: 8630
nosy: vsrinivas
status: unread
title: vm_zeroidle: Detect movnti and enable bzeront if it is available
_____________________________________________________
DragonFly issue tracker <bugs at lists.dragonflybsd.org>
<http://bugs.dragonflybsd.org/issue1776>
_____________________________________________________
More information about the Bugs
mailing list