Module Name: src
Committed By: ad
Date: Fri May 15 22:19:01 UTC 2020
Modified Files:
src/sys/arch/x86/x86: pmap.c
Log Message:
PR kern/55268: tmpfs is slow
pmap_clear_attrs(): if a brand new page with no mappings just zap pp_attrs.
To generate a diff of this commit:
cvs rdiff -u -r1.389 -r1.390 src/sys/arch/x86/x86/pmap.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.389 src/sys/arch/x86/x86/pmap.c:1.390
--- src/sys/arch/x86/x86/pmap.c:1.389 Fri May 8 00:49:43 2020
+++ src/sys/arch/x86/x86/pmap.c Fri May 15 22:19:01 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.389 2020/05/08 00:49:43 riastradh Exp $ */
+/* $NetBSD: pmap.c,v 1.390 2020/05/15 22:19:01 ad Exp $ */
/*
* Copyright (c) 2008, 2010, 2016, 2017, 2019, 2020 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.389 2020/05/08 00:49:43 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.390 2020/05/15 22:19:01 ad Exp $");
#include "opt_user_ldt.h"
#include "opt_lockdebug.h"
@@ -4567,7 +4567,19 @@ pmap_clear_attrs(struct vm_page *pg, uns
pp = VM_PAGE_TO_PP(pg);
pa = VM_PAGE_TO_PHYS(pg);
- return pmap_pp_clear_attrs(pp, pa, clearbits);
+ /*
+ * If this is a new page, assert it has no mappings and simply zap
+ * the stored attributes without taking any locks.
+ */
+ if ((pg->flags & PG_FAKE) != 0) {
+ KASSERT(atomic_load_relaxed(&pp->pp_pte.pte_va) == 0);
+ KASSERT(atomic_load_relaxed(&pp->pp_pte.pte_ptp) == NULL);
+ KASSERT(atomic_load_relaxed(&pp->pp_pvlist.lh_first) == NULL);
+ atomic_store_relaxed(&pp->pp_attrs, 0);
+ return false;
+ } else {
+ return pmap_pp_clear_attrs(pp, pa, clearbits);
+ }
}
/*