Project

General

Profile

Actions

Bug #1776

closed

vm_zeroidle: Detect movnti and enable bzeront if it is available

Added by vsrinivas almost 14 years ago. Updated almost 14 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

Description

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

Actions #1

Updated by vsrinivas almost 14 years ago

Now available in my git tree, branch zerothread.

Actions #2

Updated by vsrinivas almost 14 years ago

Resolved by commit 5e9b48f4a9519a1059ebf7ec66bb8cc8edc86233.

Actions

Also available in: Atom PDF