Date: Sat, 4 Jul 2020 08:34:43 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r362926 - stable/12/sys/amd64/amd64 Message-ID: <202007040834.0648Yhx3007481@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Sat Jul 4 08:34:43 2020 New Revision: 362926 URL: https://svnweb.freebsd.org/changeset/base/362926 Log: MFC r362706: amd64 pmap: explain ptepindex. Modified: stable/12/sys/amd64/amd64/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/pmap.c ============================================================================== --- stable/12/sys/amd64/amd64/pmap.c Sat Jul 4 07:04:56 2020 (r362925) +++ stable/12/sys/amd64/amd64/pmap.c Sat Jul 4 08:34:43 2020 (r362926) @@ -3618,6 +3618,29 @@ pmap_pinit(pmap_t pmap) * one or two pages may be held during the wait, only to be released * afterwards. This conservative approach is easily argued to avoid * race conditions. + * + * The ptepindexes, i.e. page indices, of the page table pages encountered + * while translating virtual address va are defined as follows: + * - for the page table page (last level), + * ptepindex = pmap_pde_pindex(va) = va >> PDRSHIFT, + * in other words, it is just the index of the PDE that maps the page + * table page. + * - for the page directory page, + * ptepindex = NUPDE (number of userland PD entries) + + * (pmap_pde_index(va) >> NPDEPGSHIFT) + * i.e. index of PDPE is put after the last index of PDE, + * - for the page directory pointer page, + * ptepindex = NUPDE + NUPDPE + (pmap_pde_index(va) >> (NPDEPGSHIFT + + * NPML4EPGSHIFT), + * i.e. index of pml4e is put after the last index of PDPE. + * + * Define an order on the paging entries, where all entries of the + * same height are put together, then heights are put from deepest to + * root. Then ptexpindex is the sequential number of the + * corresponding paging entry in this order. + * + * The root page at PML4 does not participate in this indexing scheme, since + * it is statically allocated by pmap_pinit() and not by _pmap_allocpte(). */ static vm_page_t _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202007040834.0648Yhx3007481>