aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2023-02-06 22:33:28 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2023-02-06 22:33:28 +0000
commit819ed472043c8067d45b5c4608c8a6fb05ff7f04 (patch)
treee3ef5b6a3972b42507ed6e70033b3b257d4602ac
parent393b0ba25f1a54dcc3f94244933c665f1c471d1a (diff)
downloadsrc-819ed472043c8067d45b5c4608c8a6fb05ff7f04.tar.gz
src-819ed472043c8067d45b5c4608c8a6fb05ff7f04.zip
amd64 pmap: patch up a comment in pmap_init_pv_table
Requested by: jhb
-rw-r--r--sys/amd64/amd64/pmap.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index a86487310aff..a31cdb2a8215 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -2314,9 +2314,13 @@ pmap_init_pv_table(void)
int domain, i, j, pages;
/*
- * We strongly depend on the size being a power of two, so the assert
- * is overzealous. However, should the struct be resized to a
- * different power of two, the code below needs to be revisited.
+ * For correctness we depend on the size being evenly divisible into a
+ * page. As a tradeoff between performance and total memory use, the
+ * entry is 64 bytes (aka one cacheline) in size. Not being smaller
+ * avoids false-sharing, but not being 128 bytes potentially allows for
+ * avoidable traffic due to adjacent cacheline prefetcher.
+ *
+ * Assert the size so that accidental changes fail to compile.
*/
CTASSERT((sizeof(*pvd) == 64));