remove __pgd_offset
Subsystems (4)
PATCH 1/1 remove __pgd_offset
__pgd_offset() and pgd_offset() are completely different functions. __pgd_offset() is really just a helper to figure out which entry in a
pgd an address would fall into. pgd_offset() does all the leg work and
actually fetches the real pgd entry.
pgd_index() is a much saner name for what __pgd_offset() does. In fact, we do this:
#define __pgd_offset(address) pgd_index(address)
The attached patch removes all instances of __pgd_offset and just replaces them with pgd_index.
Compiles with and without PAE on x86.
Signature · 2 lines
Dave Hansen [email protected]
arch/alpha/mm/fault.c renamed from linux-2.5.63-clean/arch/alpha/mm/fault.c +3 -3
@@ -232,11 +232,11 @@else {/* Synchronize this task's top level page-table with the "reference" page table from init. */ -long offset =__pgd_offset (address); +long index =pgd_index (address);pgd_t *pgd, *pgd_k; - pgd = current->active_mm->pgd + offset; - pgd_k = swapper_pg_dir + offset; + pgd = current->active_mm->pgd + index; + pgd_k = swapper_pg_dir + index;if (!pgd_present (*pgd) &&pgd_present (*pgd_k)) {pgd_val (*pgd) =pgd_val (*pgd_k);return ;
arch/arm/mm/fault-common.c renamed from linux-2.5.63-clean/arch/arm/mm/fault-common.c +4 -4
@@ -342,20 +342,20 @@ struct pt_regs *regs) {struct task_struct *tsk; -unsigned int offset; +unsigned int index;pgd_t *pgd, *pgd_k;pmd_t *pmd, *pmd_k;if (addr <TASK_SIZE )return do_page_fault (addr, fsr, regs); - offset =__pgd_offset (addr); + index =pgd_index (addr);/* * FIXME: CP15 C1 is write only on ARMv3 architectures. */ - pgd =cpu_get_pgd () + offset; - pgd_k = init_mm.pgd + offset; + pgd =cpu_get_pgd () + index; + pgd_k = init_mm.pgd + index;if (pgd_none (*pgd_k)) goto bad_area;
arch/i386/mm/fault.c renamed from linux-2.5.63-clean/arch/i386/mm/fault.c +3 -3
@@ -394,14 +394,14 @@* Do _not_ use "tsk" here. We might be inside * an interrupt in the middle of a task switch.. */ -int offset =__pgd_offset (address); +int index =pgd_index (address);pgd_t *pgd, *pgd_k;pmd_t *pmd, *pmd_k;pte_t *pte_k; asm("movl %%cr3,%0" :"=r" (pgd)); - pgd = offset + (pgd_t *)__va (pgd); - pgd_k = init_mm.pgd + offset; + pgd = index + (pgd_t *)__va (pgd); + pgd_k = init_mm.pgd + index;if (!pgd_present (*pgd_k)) goto no_context;
arch/i386/mm/init.c renamed from linux-2.5.63-clean/arch/i386/mm/init.c +9 -9
@@ -98,15 +98,15 @@ {pgd_t *pgd;pmd_t *pmd; -int pgd_ofs, pmd_ofs; +int pgd_idx, pmd_ofs;unsigned long vaddr; vaddr = start; - pgd_ofs =__pgd_offset (vaddr); + pgd_idx =pgd_index (vaddr); pmd_ofs =__pmd_offset (vaddr); - pgd = pgd_base + pgd_ofs; + pgd = pgd_base + pgd_idx; -for ( ; (pgd_ofs <PTRS_PER_PGD ) && (vaddr != end); pgd++, pgd_ofs++) { +for ( ; (pgd_idx <PTRS_PER_PGD ) && (vaddr != end); pgd++, pgd_idx++) {if (pgd_none (*pgd))one_md_table_init (pgd);
@@ -132,13 +132,13 @@pgd_t *pgd;pmd_t *pmd;pte_t *pte; -int pgd_ofs, pmd_ofs, pte_ofs; +int pgd_idx, pmd_ofs, pte_ofs; - pgd_ofs =__pgd_offset (PAGE_OFFSET ); - pgd = pgd_base + pgd_ofs; + pgd_idx =pgd_index (PAGE_OFFSET ); + pgd = pgd_base + pgd_idx; pfn =0 ; -for (; pgd_ofs <PTRS_PER_PGD ; pgd++, pgd_ofs++) { +for (; pgd_idx <PTRS_PER_PGD ; pgd++, pgd_idx++) { pmd =one_md_table_init (pgd);if (pfn >= max_low_pfn)continue ;
@@ -214,7 +214,7 @@ vaddr =PKMAP_BASE ;page_table_range_init (vaddr, vaddr +PAGE_SIZE *LAST_PKMAP , pgd_base); - pgd = swapper_pg_dir +__pgd_offset (vaddr); + pgd = swapper_pg_dir +pgd_index (vaddr); pmd =pmd_offset (pgd, vaddr); pte =pte_offset_kernel (pmd, vaddr); pkmap_page_table = pte;
arch/i386/mm/pgtable.c renamed from linux-2.5.63-clean/arch/i386/mm/pgtable.c +2 -2
@@ -63,7 +63,7 @@pmd_t *pmd;pte_t *pte; - pgd = swapper_pg_dir +__pgd_offset (vaddr); + pgd = swapper_pg_dir +pgd_index (vaddr);if (pgd_none (*pgd)) {BUG ();return ;
@@ -103,7 +103,7 @@printk ("set_pmd_pfn: pfn misaligned\n" );return ;/* BUG(); */ } - pgd = swapper_pg_dir +__pgd_offset (vaddr); + pgd = swapper_pg_dir +pgd_index (vaddr);if (pgd_none (*pgd)) {printk ("set_pmd_pfn: pgd_none\n" );return ;/* BUG(); */
arch/um/kernel/mem.c renamed from linux-2.5.63-clean/arch/um/kernel/mem.c +2 -2
@@ -154,7 +154,7 @@unsigned long vaddr; vaddr = start; - i =__pgd_offset (vaddr); + i =pgd_index (vaddr); j =__pmd_offset (vaddr); pgd = pgd_base + i;
@@ -257,7 +257,7 @@ vaddr =PKMAP_BASE ;fixrange_init (vaddr, vaddr +PAGE_SIZE *LAST_PKMAP , swapper_pg_dir); - pgd = swapper_pg_dir +__pgd_offset (vaddr); + pgd = swapper_pg_dir +pgd_index (vaddr); pmd =pmd_offset (pgd, vaddr); pte =pte_offset_kernel (pmd, vaddr); pkmap_page_table = pte;
include/asm-alpha/pgtable.h renamed from linux-2.5.63-clean/include/asm-alpha/pgtable.h +0 -1
@@ -273,7 +273,6 @@/* to find an entry in a page-table-directory. */ #define pgd_index (address) ((address >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1)) -#define __pgd_offset (address) pgd_index(address)#define pgd_offset (mm, address) ((mm)->pgd+pgd_index(address))/* Find an entry in the second-level page table.. */
include/asm-arm/pgtable.h renamed from linux-2.5.63-clean/include/asm-arm/pgtable.h +0 -1
@@ -116,7 +116,6 @@/* to find an entry in a page-table-directory */ #define pgd_index (addr) ((addr) >> PGDIR_SHIFT) -#define __pgd_offset (addr) pgd_index(addr)#define pgd_offset (mm, addr) ((mm)->pgd+pgd_index(addr))
include/asm-i386/pgtable.h renamed from linux-2.5.63-clean/include/asm-i386/pgtable.h +0 -2
@@ -236,8 +236,6 @@/* to find an entry in a page-table-directory. */ #define pgd_index (address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) -#define __pgd_offset (address) pgd_index(address) -#define pgd_offset (mm, address) ((mm)->pgd+pgd_index(address))/* to find an entry in a kernel page-table-directory */
include/asm-sh/pgtable.h renamed from linux-2.5.63-clean/include/asm-sh/pgtable.h +0 -1
@@ -274,7 +274,6 @@/* to find an entry in a page-table-directory. */ #define pgd_index (address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) -#define __pgd_offset (address) pgd_index(address)#define pgd_offset (mm, address) ((mm)->pgd+pgd_index(address))/* to find an entry in a kernel page-table-directory */
include/asm-um/pgtable.h renamed from linux-2.5.63-clean/include/asm-um/pgtable.h +0 -1
@@ -357,7 +357,6 @@/* to find an entry in a page-table-directory. */ #define pgd_index (address) ((address >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) -#define __pgd_offset (address) pgd_index(address)/* to find an entry in a page-table-directory */ #define pgd_offset (mm, address) \
PATCH 1/1 remove __pmd_offset
Same thing as the __pgd_offset one, just for pmds this time to keep the naming consistent.
Signature · 2 lines
Dave Hansen [email protected]
arch/i386/mm/init.c +6 -6
@@ -98,12 +98,12 @@ {pgd_t *pgd;pmd_t *pmd; -int pgd_idx, pmd_ofs; +int pgd_idx, pmd_idx;unsigned long vaddr; vaddr = start; pgd_idx =pgd_index (vaddr); - pmd_ofs =__pmd_offset (vaddr); + pmd_idx =pmd_index (vaddr); pgd = pgd_base + pgd_idx;for ( ; (pgd_idx <PTRS_PER_PGD ) && (vaddr != end); pgd++, pgd_idx++) {
@@ -111,13 +111,13 @@one_md_table_init (pgd); pmd =pmd_offset (pgd, vaddr); -for (; (pmd_ofs <PTRS_PER_PMD ) && (vaddr != end); pmd++, pmd_ofs++) { +for (; (pmd_idx <PTRS_PER_PMD ) && (vaddr != end); pmd++, pmd_idx++) {if (pmd_none (*pmd))one_page_table_init (pmd); vaddr +=PMD_SIZE ; } - pmd_ofs =0 ; + pmd_idx =0 ; } }
@@ -132,7 +132,7 @@pgd_t *pgd;pmd_t *pmd;pte_t *pte; -int pgd_idx, pmd_ofs, pte_ofs; +int pgd_idx, pmd_idx, pte_ofs; pgd_idx =pgd_index (PAGE_OFFSET ); pgd = pgd_base + pgd_idx;
@@ -142,7 +142,7 @@ pmd =one_md_table_init (pgd);if (pfn >= max_low_pfn)continue ; -for (pmd_ofs =0 ; pmd_ofs <PTRS_PER_PMD && pfn < max_low_pfn; pmd++, pmd_ofs++) { +for (pmd_idx =0 ; pmd_idx <PTRS_PER_PMD && pfn < max_low_pfn; pmd++, pmd_idx++) {/* Map with big pages if possible, otherwise create normal page tables. */ if (cpu_has_pse) {set_pmd (pmd,pfn_pmd (pfn,PAGE_KERNEL_LARGE ));
arch/um/kernel/mem.c +1 -1
@@ -155,7 +155,7 @@ vaddr = start; i =pgd_index (vaddr); - j =__pmd_offset (vaddr); + j =pmd_index (vaddr); pgd = pgd_base + i;for ( ; (i <PTRS_PER_PGD ) && (vaddr < end); pgd++, i++) {
Only in linux-2.5.63-pmdindex/include/asm-i386: .pgtable.h.swp
include/asm-i386/pgtable-3level.h +1 -1
@@ -69,7 +69,7 @@/* Find an entry in the second-level page table.. */ #define pmd_offset (dir, address) ((pmd_t *) pgd_page(*(dir)) + \ - __pmd_offset(address)) + pmd_index(address))static inline pte_t ptep_get_and_clear (pte_t *ptep) {
include/asm-i386/pgtable.h +1 -1
@@ -241,7 +241,7 @@/* to find an entry in a kernel page-table-directory */ #define pgd_offset_k (address) pgd_offset(&init_mm, address) -#define __pmd_offset (address) \ +#define pmd_index (address) \ (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))/* Find an entry in the third-level page table.. */
include/asm-s390x/pgtable.h +2 -2
@@ -488,9 +488,9 @@#define pgd_offset_k (address) pgd_offset(&init_mm, address)/* Find an entry in the second-level page table.. */ -#define __pmd_offset (address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) +#define pmd_index (address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))#define pmd_offset (dir,addr) \ - ((pmd_t *) pgd_page_kernel(*(dir)) + __pmd_offset(addr)) + ((pmd_t *) pgd_page_kernel(*(dir)) + pmd_index(addr))/* Find an entry in the third-level page table.. */ #define __pte_offset (address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE-1))
include/asm-um/pgtable.h +1 -1
@@ -365,7 +365,7 @@/* to find an entry in a kernel page-table-directory */ #define pgd_offset_k (address) pgd_offset(&init_mm, address) -#define __pmd_offset (address) \ +#define pmd_index (address) \ (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))/* Find an entry in the second-level page table.. */
include/asm-x86_64/pgtable.h +2 -2
@@ -321,9 +321,9 @@#define pmd_page_kernel (pmd) ((unsigned long) __va(pmd_val(pmd) & PTE_MASK))#define pmd_page (pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) -#define __pmd_offset (address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) +#define pmd_index (address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))#define pmd_offset (dir, address) ((pmd_t *) pgd_page(*(dir)) + \ - __pmd_offset(address)) + pmd_index(address))#define pmd_none (x) (!pmd_val(x))#define pmd_present (x) (pmd_val(x) & _PAGE_PRESENT)#define pmd_clear (xp) do { set_pmd(xp, __pmd(0)); } while (0)
PATCH 1/1 remove __pte_offset
In reply to Dave Hansenptes this time
Signature · 2 lines
Dave Hansen [email protected]
include/asm-i386/pgtable.h +5 -5
@@ -245,21 +245,21 @@ (((address) >>PMD_SHIFT ) & (PTRS_PER_PMD -1 )) /* Find an entry in the third-level page table.. */ -#define __pte_offset (address) \ +#define pte_index (address) \ (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))#define pte_offset_kernel (dir, address) \ - ((pte_t *) pmd_page_kernel(*(dir)) + __pte_offset(address)) + ((pte_t *) pmd_page_kernel(*(dir)) + pte_index(address))#if defined(CONFIG_HIGHPTE )#define pte_offset_map (dir, address) \ - ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE0) + __pte_offset(address)) + ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE0) + pte_index(address))#define pte_offset_map_nested (dir, address) \ - ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE1) + __pte_offset(address)) + ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE1) + pte_index(address))#define pte_unmap (pte) kunmap_atomic(pte, KM_PTE0)#define pte_unmap_nested (pte) kunmap_atomic(pte, KM_PTE1)#else #define pte_offset_map (dir, address) \ - ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) + ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address))#define pte_offset_map_nested (dir, address) pte_offset_map(dir, address)#define pte_unmap (pte) do { } while (0)#define pte_unmap_nested (pte) do { } while (0)
include/asm-ia64/pgtable.h +2 -2
@@ -317,8 +317,8 @@* Find an entry in the third-level page table. This looks more complicated than it * should be because some platforms place page tables in high memory. */ -#define __pte_offset (addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) -#define pte_offset_kernel (dir,addr) ((pte_t *) pmd_page_kernel(*(dir)) + __pte_offset(addr)) +#define pte_index (addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) +#define pte_offset_kernel (dir,addr) ((pte_t *) pmd_page_kernel(*(dir)) + pte_index(addr))#define pte_offset_map (dir,addr) pte_offset_kernel(dir, addr)#define pte_offset_map_nested (dir,addr) pte_offset_map(dir, addr)#define pte_unmap (pte) do { } while (0)
include/asm-m68k/sun3_pgtable.h +3 -3
@@ -196,10 +196,10 @@ }/* Find an entry in the third-level pagetable. */ -#define __pte_offset (address) ((address >> PAGE_SHIFT) & (PTRS_PER_PTE-1)) -#define pte_offset_kernel (pmd, address) ((pte_t *) __pmd_page(*pmd) + __pte_offset(address)) +#define pte_index (address) ((address >> PAGE_SHIFT) & (PTRS_PER_PTE-1)) +#define pte_offset_kernel (pmd, address) ((pte_t *) __pmd_page(*pmd) + pte_index(address))/* FIXME: should we bother with kmap() here? */ -#define pte_offset_map (pmd, address) ((pte_t *)kmap(pmd_page(*pmd)) + __pte_offset(address)) +#define pte_offset_map (pmd, address) ((pte_t *)kmap(pmd_page(*pmd)) + pte_index(address))#define pte_offset_map_nested (pmd, address) pte_offset_map(pmd, address)#define pte_unmap (pte) kunmap(pte)#define pte_unmap_nested (pte) kunmap(pte)
include/asm-parisc/pgtable.h +2 -2
@@ -329,9 +329,9 @@#endif /* Find an entry in the third-level page table.. */ -#define __pte_offset (address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE-1)) +#define pte_index (address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE-1))#define pte_offset_kernel (pmd, address) \ - ((pte_t *) pmd_page_kernel(*(pmd)) + __pte_offset(address)) + ((pte_t *) pmd_page_kernel(*(pmd)) + pte_index(address))#define pte_offset_map (pmd, address) pte_offset_kernel(pmd, address)#define pte_offset_map_nested (pmd, address) pte_offset_kernel(pmd, address)#define pte_unmap (pte) do { } while (0)
include/asm-ppc/pgtable.h +4 -4
@@ -494,14 +494,14 @@ }/* Find an entry in the third-level page table.. */ -#define __pte_offset (address) \ +#define pte_index (address) \ (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))#define pte_offset_kernel (dir, addr) \ - ((pte_t *) pmd_page_kernel(*(dir)) + __pte_offset(addr)) + ((pte_t *) pmd_page_kernel(*(dir)) + pte_index(addr))#define pte_offset_map (dir, addr) \ - ((pte_t *) kmap_atomic(pmd_page(*(dir)), KM_PTE0) + __pte_offset(addr)) + ((pte_t *) kmap_atomic(pmd_page(*(dir)), KM_PTE0) + pte_index(addr))#define pte_offset_map_nested (dir, addr) \ - ((pte_t *) kmap_atomic(pmd_page(*(dir)), KM_PTE1) + __pte_offset(addr)) + ((pte_t *) kmap_atomic(pmd_page(*(dir)), KM_PTE1) + pte_index(addr))#define pte_unmap (pte) kunmap_atomic(pte, KM_PTE0)#define pte_unmap_nested (pte) kunmap_atomic(pte, KM_PTE1)
include/asm-s390/pgtable.h +2 -2
@@ -467,9 +467,9 @@ }/* Find an entry in the third-level page table.. */ -#define __pte_offset (address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE-1)) +#define pte_index (address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE-1))#define pte_offset_kernel (pmd, address) \ - ((pte_t *) pmd_page_kernel(*(pmd)) + __pte_offset(address)) + ((pte_t *) pmd_page_kernel(*(pmd)) + pte_index(address))#define pte_offset_map (pmd, address) pte_offset_kernel(pmd, address)#define pte_offset_map_nested (pmd, address) pte_offset_kernel(pmd, address)#define pte_unmap (pte) do { } while (0)
include/asm-s390x/pgtable.h +2 -2
@@ -493,9 +493,9 @@ ((pmd_t *)pgd_page_kernel (*(dir)) +pmd_index (addr)) /* Find an entry in the third-level page table.. */ -#define __pte_offset (address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE-1)) +#define pte_index (address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE-1))#define pte_offset_kernel (pmd, address) \ - ((pte_t *) pmd_page_kernel(*(pmd)) + __pte_offset(address)) + ((pte_t *) pmd_page_kernel(*(pmd)) + pte_index(address))#define pte_offset_map (pmd, address) pte_offset_kernel(pmd, address)#define pte_offset_map_nested (pmd, address) pte_offset_kernel(pmd, address)#define pte_unmap (pte) do { } while (0)
include/asm-sh/pgtable.h +2 -2
@@ -280,10 +280,10 @@#define pgd_offset_k (address) pgd_offset(&init_mm, address)/* Find an entry in the third-level page table.. */ -#define __pte_offset (address) \ +#define pte_index (address) \ ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))#define pte_offset (dir, address) ((pte_t *) pmd_page(*(dir)) + \ - __pte_offset(address)) + pte_index(address))extern void update_mmu_cache (struct vm_area_struct * vma,unsigned long address,pte_t pte);
include/asm-sparc64/pgtable.h +4 -4
@@ -273,11 +273,11 @@ ((address >> PMD_SHIFT) & (REAL_PTRS_PER_PMD-1)))/* Find an entry in the third-level page table.. */ -#define __pte_offset (dir, address) ((pte_t *) __pmd_page(*(dir)) + \ +#define pte_index (dir, address) ((pte_t *) __pmd_page(*(dir)) + \ ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) -#define pte_offset_kernel __pte_offset -#define pte_offset_map __pte_offset -#define pte_offset_map_nested __pte_offset +#define pte_offset_kernel pte_index +#define pte_offset_map pte_index +#define pte_offset_map_nested pte_index#define pte_unmap (pte) do { } while (0)#define pte_unmap_nested (pte) do { } while (0)
include/asm-um/pgtable.h +4 -4
@@ -375,13 +375,13 @@ }/* Find an entry in the third-level page table.. */ -#define __pte_offset (address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) +#define pte_index (address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))#define pte_offset_kernel (dir, address) \ - ((pte_t *) pmd_page_kernel(*(dir)) + __pte_offset(address)) + ((pte_t *) pmd_page_kernel(*(dir)) + pte_index(address))#define pte_offset_map (dir, address) \ - ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE0) + __pte_offset(address)) + ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE0) + pte_index(address))#define pte_offset_map_nested (dir, address) \ - ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE1) + __pte_offset(address)) + ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE1) + pte_index(address))#define pte_unmap (pte) kunmap_atomic((pte), KM_PTE0)#define pte_unmap_nested (pte) kunmap_atomic((pte), KM_PTE1)
include/asm-x86_64/pgtable.h +2 -2
@@ -353,10 +353,10 @@return pte; } -#define __pte_offset (address) \ +#define pte_index (address) \ ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))#define pte_offset_kernel (dir, address) ((pte_t *) pmd_page_kernel(*(dir)) + \ - __pte_offset(address)) + pte_index(address))/* x86-64 always has all page tables mapped. */ #define pte_offset_map (dir,address) pte_offset_kernel(dir,address)
Re: [PATCH] remove __pte_offset
In reply to Benjamin LaHaiseQuoted 5 lines
Quoted 1 line
ptes this time
Isn't
pte_to_pfna better name? index doesn't have a type of data implied, whereas pfn does. We have to make these distinctions clearer as work like William'sPAGE_SIZEis being done.
For pte_index? Surely they're completely separate things? pte_index returns a virtual address offset into the pte, and pte_to_pfn returns a physical address?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]">[email protected]</a>
Re: [PATCH] remove __pte_offset
In reply to Dave HansenQuoted 1 line · Dave Hansen
ptes this time
Isn't pte_to_pfn a better name? index doesn't have a type of data implied, whereas pfn does. We have to make these distinctions clearer as work like William's PAGE_SIZE is being done.
-ben
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]">[email protected]</a>
Re: [PATCH] remove __pte_offset
Quoted 6 lines · Benjamin LaHaise
Quoted 2 lines · Dave Hansen
ptes this time
Isn'tpte_to_pfna better name? index doesn't have a type of dataimplied, whereas pfn does. We have to make these distinctions clearer as work like William's
PAGE_SIZEis being done.
Works for me. Here's an updated patch.
Signature · 2 lines
Dave Hansen [email protected]
include/asm-i386/pgtable.h +5 -5
@@ -245,21 +245,21 @@ (((address) >>PMD_SHIFT ) & (PTRS_PER_PMD -1 )) /* Find an entry in the third-level page table.. */ -#define __pte_offset (address) \ +#define pte_to_pfn (address) \ (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))#define pte_offset_kernel (dir, address) \ - ((pte_t *) pmd_page_kernel(*(dir)) + __pte_offset(address)) + ((pte_t *) pmd_page_kernel(*(dir)) + pte_to_pfn(address))#if defined(CONFIG_HIGHPTE )#define pte_offset_map (dir, address) \ - ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE0) + __pte_offset(address)) + ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE0) + pte_to_pfn(address))#define pte_offset_map_nested (dir, address) \ - ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE1) + __pte_offset(address)) + ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE1) + pte_to_pfn(address))#define pte_unmap (pte) kunmap_atomic(pte, KM_PTE0)#define pte_unmap_nested (pte) kunmap_atomic(pte, KM_PTE1)#else #define pte_offset_map (dir, address) \ - ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) + ((pte_t *)page_address(pmd_page(*(dir))) + pte_to_pfn(address))#define pte_offset_map_nested (dir, address) pte_offset_map(dir, address)#define pte_unmap (pte) do { } while (0)#define pte_unmap_nested (pte) do { } while (0)
include/asm-ia64/pgtable.h +2 -2
@@ -317,8 +317,8 @@* Find an entry in the third-level page table. This looks more complicated than it * should be because some platforms place page tables in high memory. */ -#define __pte_offset (addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) -#define pte_offset_kernel (dir,addr) ((pte_t *) pmd_page_kernel(*(dir)) + __pte_offset(addr)) +#define pte_to_pfn (addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) +#define pte_offset_kernel (dir,addr) ((pte_t *) pmd_page_kernel(*(dir)) + pte_to_pfn(addr))#define pte_offset_map (dir,addr) pte_offset_kernel(dir, addr)#define pte_offset_map_nested (dir,addr) pte_offset_map(dir, addr)#define pte_unmap (pte) do { } while (0)
include/asm-m68k/sun3_pgtable.h +3 -3
@@ -196,10 +196,10 @@ }/* Find an entry in the third-level pagetable. */ -#define __pte_offset (address) ((address >> PAGE_SHIFT) & (PTRS_PER_PTE-1)) -#define pte_offset_kernel (pmd, address) ((pte_t *) __pmd_page(*pmd) + __pte_offset(address)) +#define pte_to_pfn (address) ((address >> PAGE_SHIFT) & (PTRS_PER_PTE-1)) +#define pte_offset_kernel (pmd, address) ((pte_t *) __pmd_page(*pmd) + pte_to_pfn(address))/* FIXME: should we bother with kmap() here? */ -#define pte_offset_map (pmd, address) ((pte_t *)kmap(pmd_page(*pmd)) + __pte_offset(address)) +#define pte_offset_map (pmd, address) ((pte_t *)kmap(pmd_page(*pmd)) + pte_to_pfn(address))#define pte_offset_map_nested (pmd, address) pte_offset_map(pmd, address)#define pte_unmap (pte) kunmap(pte)#define pte_unmap_nested (pte) kunmap(pte)
include/asm-parisc/pgtable.h +2 -2
@@ -329,9 +329,9 @@#endif /* Find an entry in the third-level page table.. */ -#define __pte_offset (address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE-1)) +#define pte_to_pfn (address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE-1))#define pte_offset_kernel (pmd, address) \ - ((pte_t *) pmd_page_kernel(*(pmd)) + __pte_offset(address)) + ((pte_t *) pmd_page_kernel(*(pmd)) + pte_to_pfn(address))#define pte_offset_map (pmd, address) pte_offset_kernel(pmd, address)#define pte_offset_map_nested (pmd, address) pte_offset_kernel(pmd, address)#define pte_unmap (pte) do { } while (0)
include/asm-ppc/pgtable.h +4 -4
@@ -494,14 +494,14 @@ }/* Find an entry in the third-level page table.. */ -#define __pte_offset (address) \ +#define pte_to_pfn (address) \ (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))#define pte_offset_kernel (dir, addr) \ - ((pte_t *) pmd_page_kernel(*(dir)) + __pte_offset(addr)) + ((pte_t *) pmd_page_kernel(*(dir)) + pte_to_pfn(addr))#define pte_offset_map (dir, addr) \ - ((pte_t *) kmap_atomic(pmd_page(*(dir)), KM_PTE0) + __pte_offset(addr)) + ((pte_t *) kmap_atomic(pmd_page(*(dir)), KM_PTE0) + pte_to_pfn(addr))#define pte_offset_map_nested (dir, addr) \ - ((pte_t *) kmap_atomic(pmd_page(*(dir)), KM_PTE1) + __pte_offset(addr)) + ((pte_t *) kmap_atomic(pmd_page(*(dir)), KM_PTE1) + pte_to_pfn(addr))#define pte_unmap (pte) kunmap_atomic(pte, KM_PTE0)#define pte_unmap_nested (pte) kunmap_atomic(pte, KM_PTE1)
include/asm-s390/pgtable.h +2 -2
@@ -467,9 +467,9 @@ }/* Find an entry in the third-level page table.. */ -#define __pte_offset (address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE-1)) +#define pte_to_pfn (address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE-1))#define pte_offset_kernel (pmd, address) \ - ((pte_t *) pmd_page_kernel(*(pmd)) + __pte_offset(address)) + ((pte_t *) pmd_page_kernel(*(pmd)) + pte_to_pfn(address))#define pte_offset_map (pmd, address) pte_offset_kernel(pmd, address)#define pte_offset_map_nested (pmd, address) pte_offset_kernel(pmd, address)#define pte_unmap (pte) do { } while (0)
include/asm-s390x/pgtable.h +2 -2
@@ -493,9 +493,9 @@ ((pmd_t *)pgd_page_kernel (*(dir)) +pmd_index (addr)) /* Find an entry in the third-level page table.. */ -#define __pte_offset (address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE-1)) +#define pte_to_pfn (address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE-1))#define pte_offset_kernel (pmd, address) \ - ((pte_t *) pmd_page_kernel(*(pmd)) + __pte_offset(address)) + ((pte_t *) pmd_page_kernel(*(pmd)) + pte_to_pfn(address))#define pte_offset_map (pmd, address) pte_offset_kernel(pmd, address)#define pte_offset_map_nested (pmd, address) pte_offset_kernel(pmd, address)#define pte_unmap (pte) do { } while (0)
include/asm-sh/pgtable.h +2 -2
@@ -280,10 +280,10 @@#define pgd_offset_k (address) pgd_offset(&init_mm, address)/* Find an entry in the third-level page table.. */ -#define __pte_offset (address) \ +#define pte_to_pfn (address) \ ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))#define pte_offset (dir, address) ((pte_t *) pmd_page(*(dir)) + \ - __pte_offset(address)) + pte_to_pfn(address))extern void update_mmu_cache (struct vm_area_struct * vma,unsigned long address,pte_t pte);
include/asm-sparc64/pgtable.h +4 -4
@@ -273,11 +273,11 @@ ((address >> PMD_SHIFT) & (REAL_PTRS_PER_PMD-1)))/* Find an entry in the third-level page table.. */ -#define __pte_offset (dir, address) ((pte_t *) __pmd_page(*(dir)) + \ +#define pte_to_pfn (dir, address) ((pte_t *) __pmd_page(*(dir)) + \ ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) -#define pte_offset_kernel __pte_offset -#define pte_offset_map __pte_offset -#define pte_offset_map_nested __pte_offset +#define pte_offset_kernel pte_to_pfn +#define pte_offset_map pte_to_pfn +#define pte_offset_map_nested pte_to_pfn#define pte_unmap (pte) do { } while (0)#define pte_unmap_nested (pte) do { } while (0)
include/asm-um/pgtable.h +4 -4
@@ -375,13 +375,13 @@ }/* Find an entry in the third-level page table.. */ -#define __pte_offset (address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) +#define pte_to_pfn (address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))#define pte_offset_kernel (dir, address) \ - ((pte_t *) pmd_page_kernel(*(dir)) + __pte_offset(address)) + ((pte_t *) pmd_page_kernel(*(dir)) + pte_to_pfn(address))#define pte_offset_map (dir, address) \ - ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE0) + __pte_offset(address)) + ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE0) + pte_to_pfn(address))#define pte_offset_map_nested (dir, address) \ - ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE1) + __pte_offset(address)) + ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE1) + pte_to_pfn(address))#define pte_unmap (pte) kunmap_atomic((pte), KM_PTE0)#define pte_unmap_nested (pte) kunmap_atomic((pte), KM_PTE1)
include/asm-x86_64/pgtable.h +2 -2
@@ -353,10 +353,10 @@return pte; } -#define __pte_offset (address) \ +#define pte_to_pfn (address) \ ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))#define pte_offset_kernel (dir, address) ((pte_t *) pmd_page_kernel(*(dir)) + \ - __pte_offset(address)) + pte_to_pfn(address))/* x86-64 always has all page tables mapped. */ #define pte_offset_map (dir,address) pte_offset_kernel(dir,address)
Re: [PATCH] remove __pte_offset
In reply to Martin J. BlighQuoted 9 lines · Martin J. Bligh
Quoted 5 lines
Quoted 1 line
ptes this time
Isn't
pte_to_pfna better name? index doesn't have a type of data implied, whereas pfn does. We have to make these distinctions clearer as work like William'sPAGE_SIZEis being done.For
pte_index? Surely they're completely separate things?pte_indexreturns a virtual address offset into the pte, andpte_to_pfnreturns a physical address?
Yeah, Martin's right. I jumped the gun with that second patch
#define pte_index(address) \
(((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))We _are_ talking about the address and conversion to the index into the pte page here, not the contents of the pte and thus the pfn.
Please stop confusing me, the voices in my head are bad enough :)
Signature · 8 lines
Dave Hansen [email protected] -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]">[email protected]</a>
Re: [PATCH] remove __pte_offset
In reply to Martin J. BlighQuoted 8 lines · Martin J. Bligh
Quoted 6 lines
Quoted 2 lines
ptes this time
Isn't
pte_to_pfna better name? index doesn't have a type of data implied, whereas pfn does. We have to make these distinctions clearer as work like William'sPAGE_SIZEis being done.For
pte_index? Surely they're completely separate things?
Yes, they are. A pfn is a fairly distinct thing with "meaning".
Quoted 1 line
pte_indexreturns a virtual address offset into the pte, and
pte index into the pagetable page <thwap>
Quoted 1 line
pte_to_pfnreturns a physical address?
pageframe number.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]">[email protected]</a>
Re: [PATCH] remove __pte_offset
In reply to Martin J. BlighQuoted 3 lines · Martin J. Bligh
For
pte_index? Surely they're completely separate things?pte_indexreturns a virtual address offset into the pte, andpte_to_pfnreturns a physical address?
Sorry, I was only thinking about the type of the index initially, not the type of the data being passed into the macro. Yes, the macro does take an address, so it should be more like addr_to_pfn_index or somesuch. I still think pte_index isn't clear, though.
-ben
Signature · 6 lines
Junk email? <a href=mailto:"[email protected]">[email protected]</a> -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]">[email protected]</a>
Re: [PATCH] remove __pte_offset
Quoted 4 lines
Sorry, I was only thinking about the type of the index initially, not the type of the data being passed into the macro. Yes, the macro does take an address, so it should be more like
addr_to_pfn_indexor somesuch. I still thinkpte_indexisn't clear, though.
It's not a pfn index though - pfns are physical, this is virtual still.
It's the index into the pte page ... vaddr_to_pte_page_index I guess, but pte_index seems easier ;-)
Quoted 2 lines
akpm
pfn = pageframe number.
Right, yes ... but that's still really just a physical address (>> PAGE_SHIFT). I was trying to emphasize phys vs virt. But I was being needlessly obtuse ;-)
M.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]">[email protected]</a>
Re: [PATCH] remove __pte_offset
In reply to Benjamin LaHaiseQuoted 10 lines · Benjamin LaHaise
Quoted 3 lines · Martin J. Bligh
For
pte_index? Surely they're completely separate things?pte_indexreturns a virtual address offset into the pte, andpte_to_pfnreturns a physical address?Sorry, I was only thinking about the type of the index initially, not the type of the data being passed into the macro. Yes, the macro does take an address, so it should be more like
addr_to_pfn_indexor somesuch. I still thinkpte_indexisn't clear, though.
While we're on the subject, does anyone else find the p*_offset functions confusing?
Maybe something like this?vaddr_to_pgd_entry(mm, address)virt_to_pgd_entry(mm, address)
Signature · 8 lines
Dave Hansen [email protected] -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]">[email protected]</a>
Re: [PATCH] remove __pte_offset
Quoted 3 lines · Dave Hansen
While we're on the subject, does anyone else find the p*_offset functions confusing?
How about sticking nice comments over them, rather than rampant renamings?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]">[email protected]</a>
Re: [PATCH] remove __pte_offset
Quoted 4 lines
Quoted 2 lines
While we're on the subject, does anyone else find the p*_offset functions confusing?
How about sticking nice comments over them, rather than rampant renamings?
Would be nice if you could know what the thing did by just looking at the caller rather than the definition.
Remaning everything is probably bad, but the renames of __pgd_offset et al seem eminently sane to me, the fact that pgd_offset and __pgd_offset return different types seems like horrible confusion for no real reason or benefit, especially when pgd_index already exists ...
M.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]">[email protected]</a>
Re: [PATCH] remove __pte_offset
Quoted 6 lines · Martin J. Bligh
Quoted 5 lines
Quoted 3 lines
While we're on the subject, does anyone else find the p*_offset functions confusing?
How about sticking nice comments over them, rather than rampant renamings?
Quoted 8 lines
Would be nice if you could know what the thing did by just looking at the caller rather than the definition.
Remaning everything is probably bad, but the renames of
__pgd_offsetet al seem eminently sane to me, the fact thatpgd_offsetand__pgd_offsetreturn different types seems like horrible confusion for no real reason or benefit, especially whenpgd_indexalready exists ...
Oh I agree that pte_index is a fine name for it. But not commenting the damn things is a bug. Sigh.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]">[email protected]</a>
Re: [PATCH] remove __pte_offset
Quoted 11 lines
Quoted 10 lines · Martin J. Bligh
Quoted 2 lines
Quoted 2 lines
While we're on the subject, does anyone else find the p*_offset
functions confusing?
Quoted 2 lines
How about sticking nice comments over them, rather than rampant
renamings?
Would be nice if you could know what the thing did by just looking at the caller rather than the definition.
Quoted 8 lines
Quoted 5 lines
Remaning everything is probably bad, but the renames of
__pgd_offsetet al seem eminently sane to me, the fact thatpgd_offsetand__pgd_offsetreturn different types seems like horrible confusion for no real reason or benefit, especially whenpgd_indexalready exists ...Oh I agree that
pte_indexis a fine name for it. But not commenting the damn things is a bug. Sigh.
Hooray for that attitude!
~Randy
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]">[email protected]</a>