Module Name: src Committed By: rin Date: Fri Dec 15 09:35:29 UTC 2023
Modified Files: src/sys/arch/powerpc/oea: pmap.c Log Message: powerpc/oea: pmap: Fix mostly-pointless overhead of pmap_pvo_pool (1) Drop __aligned(32) from struct pvo_entry; otherwise, sizeof(struct pvo_entry) is round-up'ed to a multiple of 32. (2) Do not set sizeof(struct pvo_entry) to `align` argument for pool_init(9); it must be power of 2. (3) Align pvo_entry to 32-byte boundary only if reasonably possible, i.e., OEA without DIAGNOSTIC (--> POOL_REDZONE) for now. Part of PR kern/57621 To generate a diff of this commit: cvs rdiff -u -r1.118 -r1.119 src/sys/arch/powerpc/oea/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/powerpc/oea/pmap.c diff -u src/sys/arch/powerpc/oea/pmap.c:1.118 src/sys/arch/powerpc/oea/pmap.c:1.119 --- src/sys/arch/powerpc/oea/pmap.c:1.118 Fri Dec 15 09:33:29 2023 +++ src/sys/arch/powerpc/oea/pmap.c Fri Dec 15 09:35:29 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.118 2023/12/15 09:33:29 rin Exp $ */ +/* $NetBSD: pmap.c,v 1.119 2023/12/15 09:35:29 rin Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. * All rights reserved. @@ -63,7 +63,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.118 2023/12/15 09:33:29 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.119 2023/12/15 09:35:29 rin Exp $"); #define PMAP_NOOPNAMES @@ -292,7 +292,7 @@ const struct pmap_ops PMAPNAME(ops) = { #endif /* !PMAPNAME */ /* - * The following structure is aligned to 32 bytes + * The following structure is aligned to 32 bytes, if reasonably possible. */ struct pvo_entry { LIST_ENTRY(pvo_entry) pvo_vlink; /* Link to common virt page */ @@ -317,7 +317,14 @@ struct pvo_entry { #define PVO_REMOVE 6 /* PVO has been removed */ #define PVO_WHERE_MASK 15 #define PVO_WHERE_SHFT 8 -} __attribute__ ((aligned (32))); +}; + +#if defined(PMAP_OEA) && !defined(DIAGNOSTIC) +#define PMAP_PVO_ENTRY_ALIGN 32 +#else +#define PMAP_PVO_ENTRY_ALIGN __alignof(struct pvo_entry) +#endif + #define PVO_VADDR(pvo) ((pvo)->pvo_vaddr & ~ADDR_POFF) #define PVO_PTEGIDX_GET(pvo) ((pvo)->pvo_vaddr & PVO_PTEGIDX_MASK) #define PVO_PTEGIDX_ISSET(pvo) ((pvo)->pvo_vaddr & PVO_PTEGIDX_VALID) @@ -3440,7 +3447,7 @@ pmap_bootstrap1(paddr_t kernelstart, pad #endif pool_init(&pmap_pvo_pool, sizeof(struct pvo_entry), - sizeof(struct pvo_entry), 0, 0, "pmap_pvopl", + PMAP_PVO_ENTRY_ALIGN, 0, 0, "pmap_pvopl", &pmap_pool_allocator, IPL_VM); pool_setlowat(&pmap_pvo_pool, 1008);