Module Name: src
Committed By: ad
Date: Tue Dec 31 17:56:16 UTC 2019
Modified Files:
src/sys/uvm: uvm_page.h
Log Message:
struct vm_page: cluster fields most heavily used by the page allocator and
uvmpdpol at the start of the structure, so that while under global lock we
need only touch one cache line for each vm_page. There is still the problem
of vm_page not being aligned, but this seems to drop lock wait time for
(a modified) uvmpdpol and the allocator by 20-30% in a quick test.
To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/uvm/uvm_page.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/uvm/uvm_page.h
diff -u src/sys/uvm/uvm_page.h:1.91 src/sys/uvm/uvm_page.h:1.92
--- src/sys/uvm/uvm_page.h:1.91 Tue Dec 31 12:40:27 2019
+++ src/sys/uvm/uvm_page.h Tue Dec 31 17:56:16 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_page.h,v 1.91 2019/12/31 12:40:27 ad Exp $ */
+/* $NetBSD: uvm_page.h,v 1.92 2019/12/31 17:56:16 ad Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -142,6 +142,13 @@
* - uvm_pagefree: owned by a uvm_object/vm_anon -> free
* - uvm_pglistalloc: free -> allocated by uvm_pglistalloc
* - uvm_pglistfree: allocated by uvm_pglistalloc -> free
+ *
+ * On the ordering of fields:
+ *
+ * The fields most heavily used by the page allocator and uvmpdpol are
+ * clustered together at the start of the structure, so that while under
+ * global lock it's more likely that only one cache line for each page need
+ * be touched.
*/
struct vm_page {
@@ -151,16 +158,16 @@ struct vm_page {
LIST_ENTRY(vm_page) list; /* f: global free page queue */
} pageq;
TAILQ_ENTRY(vm_page) pdqueue; /* p: pagedaemon queue */
- struct vm_anon *uanon; /* o,i: anon */
- struct uvm_object *uobject; /* o,i: object */
- voff_t offset; /* o: offset into object */
+ kmutex_t interlock; /* s: lock on identity */
+ uint32_t pqflags; /* i: pagedaemon flags */
uint16_t flags; /* o: object flags */
uint16_t spare; /* : spare for now */
- uint32_t pqflags; /* p: pagedaemon flags */
+ paddr_t phys_addr; /* o: physical address of pg */
uint32_t loan_count; /* o,i: num. active loans */
uint32_t wire_count; /* o,i: wired down map refs */
- paddr_t phys_addr; /* o: physical address of pg */
- kmutex_t interlock; /* s: lock on identity */
+ struct vm_anon *uanon; /* o,i: anon */
+ struct uvm_object *uobject; /* o,i: object */
+ voff_t offset; /* o: offset into object */
#ifdef __HAVE_VM_PAGE_MD
struct vm_page_md mdpage; /* ?: pmap-specific data */