]> git.hungrycats.org Git - linux/commitdiff
[PATCH] pgd_index/pmd_index/pte_index commentary
authorAndrew Morton <akpm@digeo.com>
Tue, 18 Mar 2003 05:20:00 +0000 (21:20 -0800)
committerDave Jones <davej@codemonkey.org.uk>
Tue, 18 Mar 2003 05:20:00 +0000 (21:20 -0800)
Patch from Dave Hansen <haveblue@us.ibm.com>

Adds some commentary to these newly-introduced macros.

include/asm-i386/pgtable.h

index bcdf201861437a569ef77be9b9be3199e3ef79ac..8640f483d6eed5b387de1c770ee80e1b21099d42 100644 (file)
@@ -231,18 +231,41 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
 #define pmd_large(pmd) \
        ((pmd_val(pmd) & (_PAGE_PSE|_PAGE_PRESENT)) == (_PAGE_PSE|_PAGE_PRESENT))
 
-/* to find an entry in a page-table-directory. */
+/*
+ * the pgd page can be thought of an array like this: pgd_t[PTRS_PER_PGD]
+ *
+ * this macro returns the index of the entry in the pgd page which would
+ * control the given virtual address
+ */
 #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
 
+/*
+ * pgd_offset() returns a (pgd_t *)
+ * pgd_index() is used get the offset into the pgd page's array of pgd_t's;
+ */
 #define pgd_offset(mm, address) ((mm)->pgd+pgd_index(address))
 
-/* to find an entry in a kernel page-table-directory */
+/*
+ * a shortcut which implies the use of the kernel's pgd, instead
+ * of a process's
+ */
 #define pgd_offset_k(address) pgd_offset(&init_mm, address)
 
+/*
+ * the pmd page can be thought of an array like this: pmd_t[PTRS_PER_PMD]
+ *
+ * this macro returns the index of the entry in the pmd page which would
+ * control the given virtual address
+ */
 #define pmd_index(address) \
                (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
 
-/* Find an entry in the third-level page table.. */
+/*
+ * the pte page can be thought of an array like this: pte_t[PTRS_PER_PTE]
+ *
+ * this macro returns the index of the entry in the pte page which would
+ * control the given virtual address
+ */
 #define pte_index(address) \
                (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
 #define pte_offset_kernel(dir, address) \