Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch - On-demand zeroing pages with MOVNTI is crazy. It...
details: https://anonhg.NetBSD.org/src/rev/bdef8b446388
branches: trunk
changeset: 461322:bdef8b446388
user: ad <ad%NetBSD.org@localhost>
date: Fri Nov 22 23:36:25 2019 +0000
description:
- On-demand zeroing pages with MOVNTI is crazy. It empties L1/L2/L3.
- Disable zeroing in the idle loop. That needs a cache-friendly strategy.
Result: 3 to 4% reduction in kernel build time on my test system.
Inspired by a discussion with Mateusz Guzik and David Maxwell.
diffstat:
sys/arch/amd64/amd64/locore.S | 24 ++++++++----------------
sys/arch/x86/x86/cpu.c | 6 +++---
2 files changed, 11 insertions(+), 19 deletions(-)
diffs (68 lines):
diff -r c202dfcb1fdf -r bdef8b446388 sys/arch/amd64/amd64/locore.S
--- a/sys/arch/amd64/amd64/locore.S Fri Nov 22 23:01:49 2019 +0000
+++ b/sys/arch/amd64/amd64/locore.S Fri Nov 22 23:36:25 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.S,v 1.191 2019/11/21 19:27:54 ad Exp $ */
+/* $NetBSD: locore.S,v 1.192 2019/11/22 23:36:25 ad Exp $ */
/*
* Copyright-o-rama!
@@ -1519,24 +1519,16 @@
/*
* void pagezero(vaddr_t va)
*
- * Zero a page without polluting the cache.
+ * Zero a page.
*/
ENTRY(pagezero)
- movq $-PAGE_SIZE,%rdx
- subq %rdx,%rdi
+ pushq %rbp
+ movq %rsp,%rbp
+ movq $(PAGE_SIZE / 8),%rcx
xorq %rax,%rax
-1:
- movnti %rax,(%rdi,%rdx)
- movnti %rax,8(%rdi,%rdx)
- movnti %rax,16(%rdi,%rdx)
- movnti %rax,24(%rdi,%rdx)
- movnti %rax,32(%rdi,%rdx)
- movnti %rax,40(%rdi,%rdx)
- movnti %rax,48(%rdi,%rdx)
- movnti %rax,56(%rdi,%rdx)
- addq $64,%rdx
- jne 1b
- sfence
+ rep
+ stosq
+ leave
ret
END(pagezero)
diff -r c202dfcb1fdf -r bdef8b446388 sys/arch/x86/x86/cpu.c
--- a/sys/arch/x86/x86/cpu.c Fri Nov 22 23:01:49 2019 +0000
+++ b/sys/arch/x86/x86/cpu.c Fri Nov 22 23:36:25 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.174 2019/11/05 20:19:17 maxv Exp $ */
+/* $NetBSD: cpu.c,v 1.175 2019/11/22 23:36:25 ad Exp $ */
/*
* Copyright (c) 2000-2012 NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.174 2019/11/05 20:19:17 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.175 2019/11/22 23:36:25 ad Exp $");
#include "opt_ddb.h"
#include "opt_mpbios.h" /* for MPDEBUG */
@@ -723,7 +723,7 @@
tsc_tc_init();
/* Enable zeroing of pages in the idle loop if we have SSE2. */
- vm_page_zero_enable = ((cpu_feature[0] & CPUID_SSE2) != 0);
+ vm_page_zero_enable = false; /* ((cpu_feature[0] & CPUID_SSE2) != 0); */
}
#endif
Home |
Main Index |
Thread Index |
Old Index