git: 819ed472043c - main - amd64 pmap: patch up a comment in pmap_init_pv_table
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 06 Feb 2023 22:34:53 UTC
The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=819ed472043c8067d45b5c4608c8a6fb05ff7f04 commit 819ed472043c8067d45b5c4608c8a6fb05ff7f04 Author: Mateusz Guzik <mjg@FreeBSD.org> AuthorDate: 2023-02-06 22:33:28 +0000 Commit: Mateusz Guzik <mjg@FreeBSD.org> CommitDate: 2023-02-06 22:33:28 +0000 amd64 pmap: patch up a comment in pmap_init_pv_table Requested by: jhb --- sys/amd64/amd64/pmap.c | 10 +++++++--- 1 file 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));