linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] remove __pgd_offset
@ 2003-03-04 23:00 Dave Hansen
  2003-03-04 23:02 ` [PATCH] remove __pmd_offset Dave Hansen
  2003-03-04 23:03 ` [PATCH] remove __pte_offset Dave Hansen
  0 siblings, 2 replies; 15+ messages in thread
From: Dave Hansen @ 2003-03-04 23:00 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mm

[-- Attachment #1: Type: text/plain, Size: 555 bytes --]

__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.
-- 
Dave Hansen
haveblue@us.ibm.com

[-- Attachment #2: pgdindex-2.5.63-0.patch --]
[-- Type: text/plain, Size: 7941 bytes --]

diff -ur ../linux-2.5.63-clean/arch/alpha/mm/fault.c linux-2.5.63-pgdindex/arch/alpha/mm/fault.c
--- ../linux-2.5.63-clean/arch/alpha/mm/fault.c	Mon Feb 24 11:05:14 2003
+++ linux-2.5.63-pgdindex/arch/alpha/mm/fault.c	Tue Mar  4 14:33:00 2003
@@ -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;
diff -ur ../linux-2.5.63-clean/arch/arm/mm/fault-common.c linux-2.5.63-pgdindex/arch/arm/mm/fault-common.c
--- ../linux-2.5.63-clean/arch/arm/mm/fault-common.c	Mon Feb 24 11:05:34 2003
+++ linux-2.5.63-pgdindex/arch/arm/mm/fault-common.c	Tue Mar  4 14:33:42 2003
@@ -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;
diff -ur ../linux-2.5.63-clean/arch/i386/mm/fault.c linux-2.5.63-pgdindex/arch/i386/mm/fault.c
--- ../linux-2.5.63-clean/arch/i386/mm/fault.c	Mon Feb 24 11:05:04 2003
+++ linux-2.5.63-pgdindex/arch/i386/mm/fault.c	Tue Mar  4 14:25:06 2003
@@ -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;
diff -ur ../linux-2.5.63-clean/arch/i386/mm/init.c linux-2.5.63-pgdindex/arch/i386/mm/init.c
--- ../linux-2.5.63-clean/arch/i386/mm/init.c	Mon Feb 24 11:05:39 2003
+++ linux-2.5.63-pgdindex/arch/i386/mm/init.c	Tue Mar  4 14:38:43 2003
@@ -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;	
diff -ur ../linux-2.5.63-clean/arch/i386/mm/pgtable.c linux-2.5.63-pgdindex/arch/i386/mm/pgtable.c
--- ../linux-2.5.63-clean/arch/i386/mm/pgtable.c	Mon Feb 24 11:06:03 2003
+++ linux-2.5.63-pgdindex/arch/i386/mm/pgtable.c	Tue Mar  4 14:28:05 2003
@@ -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(); */
diff -ur ../linux-2.5.63-clean/arch/um/kernel/mem.c linux-2.5.63-pgdindex/arch/um/kernel/mem.c
--- ../linux-2.5.63-clean/arch/um/kernel/mem.c	Mon Feb 24 11:05:16 2003
+++ linux-2.5.63-pgdindex/arch/um/kernel/mem.c	Tue Mar  4 14:34:13 2003
@@ -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;
diff -ur ../linux-2.5.63-clean/include/asm-alpha/pgtable.h linux-2.5.63-pgdindex/include/asm-alpha/pgtable.h
--- ../linux-2.5.63-clean/include/asm-alpha/pgtable.h	Mon Feb 24 11:05:14 2003
+++ linux-2.5.63-pgdindex/include/asm-alpha/pgtable.h	Tue Mar  4 14:32:31 2003
@@ -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.. */
diff -ur ../linux-2.5.63-clean/include/asm-arm/pgtable.h linux-2.5.63-pgdindex/include/asm-arm/pgtable.h
--- ../linux-2.5.63-clean/include/asm-arm/pgtable.h	Mon Feb 24 11:05:14 2003
+++ linux-2.5.63-pgdindex/include/asm-arm/pgtable.h	Tue Mar  4 14:32:37 2003
@@ -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))
 
diff -ur ../linux-2.5.63-clean/include/asm-i386/pgtable.h linux-2.5.63-pgdindex/include/asm-i386/pgtable.h
--- ../linux-2.5.63-clean/include/asm-i386/pgtable.h	Mon Feb 24 11:05:39 2003
+++ linux-2.5.63-pgdindex/include/asm-i386/pgtable.h	Tue Mar  4 14:24:36 2003
@@ -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 */
diff -ur ../linux-2.5.63-clean/include/asm-sh/pgtable.h linux-2.5.63-pgdindex/include/asm-sh/pgtable.h
--- ../linux-2.5.63-clean/include/asm-sh/pgtable.h	Mon Feb 24 11:06:03 2003
+++ linux-2.5.63-pgdindex/include/asm-sh/pgtable.h	Tue Mar  4 14:32:40 2003
@@ -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 */
diff -ur ../linux-2.5.63-clean/include/asm-um/pgtable.h linux-2.5.63-pgdindex/include/asm-um/pgtable.h
--- ../linux-2.5.63-clean/include/asm-um/pgtable.h	Mon Feb 24 11:06:03 2003
+++ linux-2.5.63-pgdindex/include/asm-um/pgtable.h	Tue Mar  4 14:32:42 2003
@@ -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) \

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH] remove __pmd_offset
  2003-03-04 23:00 [PATCH] remove __pgd_offset Dave Hansen
@ 2003-03-04 23:02 ` Dave Hansen
  2003-03-04 23:03 ` [PATCH] remove __pte_offset Dave Hansen
  1 sibling, 0 replies; 15+ messages in thread
From: Dave Hansen @ 2003-03-04 23:02 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mm

[-- Attachment #1: Type: text/plain, Size: 127 bytes --]

Same thing as the __pgd_offset one, just for pmds this time to keep the
naming consistent.
-- 
Dave Hansen
haveblue@us.ibm.com

[-- Attachment #2: pmdindex-2.5.63-0.patch --]
[-- Type: text/plain, Size: 5412 bytes --]

diff -ru linux-2.5.63-pgdindex/arch/i386/mm/init.c linux-2.5.63-pmdindex/arch/i386/mm/init.c
--- linux-2.5.63-pgdindex/arch/i386/mm/init.c	Tue Mar  4 14:38:43 2003
+++ linux-2.5.63-pmdindex/arch/i386/mm/init.c	Tue Mar  4 14:40:45 2003
@@ -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));
diff -ru linux-2.5.63-pgdindex/arch/um/kernel/mem.c linux-2.5.63-pmdindex/arch/um/kernel/mem.c
--- linux-2.5.63-pgdindex/arch/um/kernel/mem.c	Tue Mar  4 14:34:13 2003
+++ linux-2.5.63-pmdindex/arch/um/kernel/mem.c	Tue Mar  4 14:40:54 2003
@@ -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
diff -ru linux-2.5.63-pgdindex/include/asm-i386/pgtable-3level.h linux-2.5.63-pmdindex/include/asm-i386/pgtable-3level.h
--- linux-2.5.63-pgdindex/include/asm-i386/pgtable-3level.h	Tue Mar  4 14:23:09 2003
+++ linux-2.5.63-pmdindex/include/asm-i386/pgtable-3level.h	Tue Mar  4 14:41:30 2003
@@ -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)
 {
diff -ru linux-2.5.63-pgdindex/include/asm-i386/pgtable.h linux-2.5.63-pmdindex/include/asm-i386/pgtable.h
--- linux-2.5.63-pgdindex/include/asm-i386/pgtable.h	Tue Mar  4 14:24:36 2003
+++ linux-2.5.63-pmdindex/include/asm-i386/pgtable.h	Tue Mar  4 14:39:45 2003
@@ -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.. */
diff -ru linux-2.5.63-pgdindex/include/asm-s390x/pgtable.h linux-2.5.63-pmdindex/include/asm-s390x/pgtable.h
--- linux-2.5.63-pgdindex/include/asm-s390x/pgtable.h	Tue Mar  4 14:23:08 2003
+++ linux-2.5.63-pmdindex/include/asm-s390x/pgtable.h	Tue Mar  4 14:41:35 2003
@@ -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))
diff -ru linux-2.5.63-pgdindex/include/asm-um/pgtable.h linux-2.5.63-pmdindex/include/asm-um/pgtable.h
--- linux-2.5.63-pgdindex/include/asm-um/pgtable.h	Tue Mar  4 14:32:42 2003
+++ linux-2.5.63-pmdindex/include/asm-um/pgtable.h	Tue Mar  4 14:39:54 2003
@@ -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.. */
diff -ru linux-2.5.63-pgdindex/include/asm-x86_64/pgtable.h linux-2.5.63-pmdindex/include/asm-x86_64/pgtable.h
--- linux-2.5.63-pgdindex/include/asm-x86_64/pgtable.h	Tue Mar  4 14:23:09 2003
+++ linux-2.5.63-pmdindex/include/asm-x86_64/pgtable.h	Tue Mar  4 14:41:38 2003
@@ -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)

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH] remove __pte_offset
  2003-03-04 23:00 [PATCH] remove __pgd_offset Dave Hansen
  2003-03-04 23:02 ` [PATCH] remove __pmd_offset Dave Hansen
@ 2003-03-04 23:03 ` Dave Hansen
  2003-03-04 23:10   ` Benjamin LaHaise
  1 sibling, 1 reply; 15+ messages in thread
From: Dave Hansen @ 2003-03-04 23:03 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mm

[-- Attachment #1: Type: text/plain, Size: 52 bytes --]

ptes this time
-- 
Dave Hansen
haveblue@us.ibm.com


[-- Attachment #2: pteindex-2.5.63-0.patch --]
[-- Type: text/plain, Size: 10790 bytes --]

diff -ru linux-2.5.63-pmdindex/include/asm-i386/pgtable.h linux-2.5.63-pteindex/include/asm-i386/pgtable.h
--- linux-2.5.63-pmdindex/include/asm-i386/pgtable.h	Tue Mar  4 14:39:45 2003
+++ linux-2.5.63-pteindex/include/asm-i386/pgtable.h	Tue Mar  4 14:45:22 2003
@@ -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)
diff -ru linux-2.5.63-pmdindex/include/asm-ia64/pgtable.h linux-2.5.63-pteindex/include/asm-ia64/pgtable.h
--- linux-2.5.63-pmdindex/include/asm-ia64/pgtable.h	Tue Mar  4 14:36:40 2003
+++ linux-2.5.63-pteindex/include/asm-ia64/pgtable.h	Tue Mar  4 14:44:49 2003
@@ -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)
diff -ru linux-2.5.63-pmdindex/include/asm-m68k/sun3_pgtable.h linux-2.5.63-pteindex/include/asm-m68k/sun3_pgtable.h
--- linux-2.5.63-pmdindex/include/asm-m68k/sun3_pgtable.h	Tue Mar  4 14:36:40 2003
+++ linux-2.5.63-pteindex/include/asm-m68k/sun3_pgtable.h	Tue Mar  4 14:44:49 2003
@@ -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)
diff -ru linux-2.5.63-pmdindex/include/asm-parisc/pgtable.h linux-2.5.63-pteindex/include/asm-parisc/pgtable.h
--- linux-2.5.63-pmdindex/include/asm-parisc/pgtable.h	Tue Mar  4 14:36:40 2003
+++ linux-2.5.63-pteindex/include/asm-parisc/pgtable.h	Tue Mar  4 14:44:49 2003
@@ -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)
diff -ru linux-2.5.63-pmdindex/include/asm-ppc/pgtable.h linux-2.5.63-pteindex/include/asm-ppc/pgtable.h
--- linux-2.5.63-pmdindex/include/asm-ppc/pgtable.h	Tue Mar  4 14:36:40 2003
+++ linux-2.5.63-pteindex/include/asm-ppc/pgtable.h	Tue Mar  4 14:44:49 2003
@@ -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)
diff -ru linux-2.5.63-pmdindex/include/asm-s390/pgtable.h linux-2.5.63-pteindex/include/asm-s390/pgtable.h
--- linux-2.5.63-pmdindex/include/asm-s390/pgtable.h	Tue Mar  4 14:36:41 2003
+++ linux-2.5.63-pteindex/include/asm-s390/pgtable.h	Tue Mar  4 14:44:49 2003
@@ -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)
diff -ru linux-2.5.63-pmdindex/include/asm-s390x/pgtable.h linux-2.5.63-pteindex/include/asm-s390x/pgtable.h
--- linux-2.5.63-pmdindex/include/asm-s390x/pgtable.h	Tue Mar  4 14:41:35 2003
+++ linux-2.5.63-pteindex/include/asm-s390x/pgtable.h	Tue Mar  4 14:44:49 2003
@@ -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)
diff -ru linux-2.5.63-pmdindex/include/asm-sh/pgtable.h linux-2.5.63-pteindex/include/asm-sh/pgtable.h
--- linux-2.5.63-pmdindex/include/asm-sh/pgtable.h	Tue Mar  4 14:36:41 2003
+++ linux-2.5.63-pteindex/include/asm-sh/pgtable.h	Tue Mar  4 14:44:49 2003
@@ -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);
diff -ru linux-2.5.63-pmdindex/include/asm-sparc64/pgtable.h linux-2.5.63-pteindex/include/asm-sparc64/pgtable.h
--- linux-2.5.63-pmdindex/include/asm-sparc64/pgtable.h	Tue Mar  4 14:36:41 2003
+++ linux-2.5.63-pteindex/include/asm-sparc64/pgtable.h	Tue Mar  4 14:44:49 2003
@@ -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)
 
diff -ru linux-2.5.63-pmdindex/include/asm-um/pgtable.h linux-2.5.63-pteindex/include/asm-um/pgtable.h
--- linux-2.5.63-pmdindex/include/asm-um/pgtable.h	Tue Mar  4 14:39:54 2003
+++ linux-2.5.63-pteindex/include/asm-um/pgtable.h	Tue Mar  4 14:44:49 2003
@@ -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)
 
diff -ru linux-2.5.63-pmdindex/include/asm-x86_64/pgtable.h linux-2.5.63-pteindex/include/asm-x86_64/pgtable.h
--- linux-2.5.63-pmdindex/include/asm-x86_64/pgtable.h	Tue Mar  4 14:41:38 2003
+++ linux-2.5.63-pteindex/include/asm-x86_64/pgtable.h	Tue Mar  4 14:44:49 2003
@@ -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)

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] remove __pte_offset
  2003-03-04 23:10   ` Benjamin LaHaise
@ 2003-03-04 23:09     ` Martin J. Bligh
  2003-03-04 23:22       ` Andrew Morton
                         ` (2 more replies)
  2003-03-04 23:16     ` Dave Hansen
  1 sibling, 3 replies; 15+ messages in thread
From: Martin J. Bligh @ 2003-03-04 23:09 UTC (permalink / raw)
  To: Benjamin LaHaise, Dave Hansen; +Cc: Andrew Morton, linux-mm

>> 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.

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 majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] remove __pte_offset
  2003-03-04 23:03 ` [PATCH] remove __pte_offset Dave Hansen
@ 2003-03-04 23:10   ` Benjamin LaHaise
  2003-03-04 23:09     ` Martin J. Bligh
  2003-03-04 23:16     ` Dave Hansen
  0 siblings, 2 replies; 15+ messages in thread
From: Benjamin LaHaise @ 2003-03-04 23:10 UTC (permalink / raw)
  To: Dave Hansen; +Cc: Andrew Morton, linux-mm

On Tue, Mar 04, 2003 at 03:03:15PM -0800, Dave Hansen wrote:
> 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 majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] remove __pte_offset
  2003-03-04 23:10   ` Benjamin LaHaise
  2003-03-04 23:09     ` Martin J. Bligh
@ 2003-03-04 23:16     ` Dave Hansen
  1 sibling, 0 replies; 15+ messages in thread
From: Dave Hansen @ 2003-03-04 23:16 UTC (permalink / raw)
  To: Benjamin LaHaise; +Cc: Andrew Morton, linux-mm

[-- Attachment #1: Type: text/plain, Size: 381 bytes --]

Benjamin LaHaise wrote:
> On Tue, Mar 04, 2003 at 03:03:15PM -0800, Dave Hansen wrote:
> 
>>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.

Works for me.  Here's an updated patch.

-- 
Dave Hansen
haveblue@us.ibm.com

[-- Attachment #2: pte_to_pfn-2.5.63-1.patch --]
[-- Type: text/plain, Size: 10822 bytes --]

diff -ru linux-2.5.63-pmdindex/include/asm-i386/pgtable.h linux-2.5.63-pteindex/include/asm-i386/pgtable.h
--- linux-2.5.63-pmdindex/include/asm-i386/pgtable.h	Tue Mar  4 14:39:45 2003
+++ linux-2.5.63-pteindex/include/asm-i386/pgtable.h	Tue Mar  4 14:45:22 2003
@@ -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)
diff -ru linux-2.5.63-pmdindex/include/asm-ia64/pgtable.h linux-2.5.63-pteindex/include/asm-ia64/pgtable.h
--- linux-2.5.63-pmdindex/include/asm-ia64/pgtable.h	Tue Mar  4 14:36:40 2003
+++ linux-2.5.63-pteindex/include/asm-ia64/pgtable.h	Tue Mar  4 14:44:49 2003
@@ -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)
diff -ru linux-2.5.63-pmdindex/include/asm-m68k/sun3_pgtable.h linux-2.5.63-pteindex/include/asm-m68k/sun3_pgtable.h
--- linux-2.5.63-pmdindex/include/asm-m68k/sun3_pgtable.h	Tue Mar  4 14:36:40 2003
+++ linux-2.5.63-pteindex/include/asm-m68k/sun3_pgtable.h	Tue Mar  4 14:44:49 2003
@@ -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)
diff -ru linux-2.5.63-pmdindex/include/asm-parisc/pgtable.h linux-2.5.63-pteindex/include/asm-parisc/pgtable.h
--- linux-2.5.63-pmdindex/include/asm-parisc/pgtable.h	Tue Mar  4 14:36:40 2003
+++ linux-2.5.63-pteindex/include/asm-parisc/pgtable.h	Tue Mar  4 14:44:49 2003
@@ -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)
diff -ru linux-2.5.63-pmdindex/include/asm-ppc/pgtable.h linux-2.5.63-pteindex/include/asm-ppc/pgtable.h
--- linux-2.5.63-pmdindex/include/asm-ppc/pgtable.h	Tue Mar  4 14:36:40 2003
+++ linux-2.5.63-pteindex/include/asm-ppc/pgtable.h	Tue Mar  4 14:44:49 2003
@@ -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)
diff -ru linux-2.5.63-pmdindex/include/asm-s390/pgtable.h linux-2.5.63-pteindex/include/asm-s390/pgtable.h
--- linux-2.5.63-pmdindex/include/asm-s390/pgtable.h	Tue Mar  4 14:36:41 2003
+++ linux-2.5.63-pteindex/include/asm-s390/pgtable.h	Tue Mar  4 14:44:49 2003
@@ -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)
diff -ru linux-2.5.63-pmdindex/include/asm-s390x/pgtable.h linux-2.5.63-pteindex/include/asm-s390x/pgtable.h
--- linux-2.5.63-pmdindex/include/asm-s390x/pgtable.h	Tue Mar  4 14:41:35 2003
+++ linux-2.5.63-pteindex/include/asm-s390x/pgtable.h	Tue Mar  4 14:44:49 2003
@@ -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)
diff -ru linux-2.5.63-pmdindex/include/asm-sh/pgtable.h linux-2.5.63-pteindex/include/asm-sh/pgtable.h
--- linux-2.5.63-pmdindex/include/asm-sh/pgtable.h	Tue Mar  4 14:36:41 2003
+++ linux-2.5.63-pteindex/include/asm-sh/pgtable.h	Tue Mar  4 14:44:49 2003
@@ -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);
diff -ru linux-2.5.63-pmdindex/include/asm-sparc64/pgtable.h linux-2.5.63-pteindex/include/asm-sparc64/pgtable.h
--- linux-2.5.63-pmdindex/include/asm-sparc64/pgtable.h	Tue Mar  4 14:36:41 2003
+++ linux-2.5.63-pteindex/include/asm-sparc64/pgtable.h	Tue Mar  4 14:44:49 2003
@@ -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)
 
diff -ru linux-2.5.63-pmdindex/include/asm-um/pgtable.h linux-2.5.63-pteindex/include/asm-um/pgtable.h
--- linux-2.5.63-pmdindex/include/asm-um/pgtable.h	Tue Mar  4 14:39:54 2003
+++ linux-2.5.63-pteindex/include/asm-um/pgtable.h	Tue Mar  4 14:44:49 2003
@@ -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)
 
diff -ru linux-2.5.63-pmdindex/include/asm-x86_64/pgtable.h linux-2.5.63-pteindex/include/asm-x86_64/pgtable.h
--- linux-2.5.63-pmdindex/include/asm-x86_64/pgtable.h	Tue Mar  4 14:41:38 2003
+++ linux-2.5.63-pteindex/include/asm-x86_64/pgtable.h	Tue Mar  4 14:44:49 2003
@@ -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)

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] remove __pte_offset
  2003-03-04 23:09     ` Martin J. Bligh
@ 2003-03-04 23:22       ` Andrew Morton
  2003-03-04 23:25       ` Dave Hansen
  2003-03-04 23:26       ` Benjamin LaHaise
  2 siblings, 0 replies; 15+ messages in thread
From: Andrew Morton @ 2003-03-04 23:22 UTC (permalink / raw)
  To: Martin J. Bligh; +Cc: bcrl, haveblue, linux-mm

"Martin J. Bligh" <mbligh@aracnet.com> wrote:
>
> >> 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.
> 
> For pte_index? Surely they're completely separate things?

Yes, they are.  A pfn is a fairly distinct thing with "meaning".

> pte_index returns a virtual address offset into the pte, and

pte index into the pagetable page <thwap>

> pte_to_pfn returns a physical address?

pageframe number.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] remove __pte_offset
  2003-03-04 23:09     ` Martin J. Bligh
  2003-03-04 23:22       ` Andrew Morton
@ 2003-03-04 23:25       ` Dave Hansen
  2003-03-04 23:26       ` Benjamin LaHaise
  2 siblings, 0 replies; 15+ messages in thread
From: Dave Hansen @ 2003-03-04 23:25 UTC (permalink / raw)
  To: Martin J. Bligh; +Cc: Benjamin LaHaise, Andrew Morton, linux-mm

Martin J. Bligh wrote:
>>>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.
> 
> 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?

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 :)
-- 
Dave Hansen
haveblue@us.ibm.com

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] remove __pte_offset
  2003-03-04 23:09     ` Martin J. Bligh
  2003-03-04 23:22       ` Andrew Morton
  2003-03-04 23:25       ` Dave Hansen
@ 2003-03-04 23:26       ` Benjamin LaHaise
  2003-03-04 23:29         ` Martin J. Bligh
  2003-03-04 23:57         ` Dave Hansen
  2 siblings, 2 replies; 15+ messages in thread
From: Benjamin LaHaise @ 2003-03-04 23:26 UTC (permalink / raw)
  To: Martin J. Bligh; +Cc: Dave Hansen, Andrew Morton, linux-mm

On Tue, Mar 04, 2003 at 03:09:21PM -0800, Martin J. Bligh wrote:
> 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?

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
-- 
Junk email?  <a href=mailto:"aart@kvack.org">aart@kvack.org</a>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] remove __pte_offset
  2003-03-04 23:26       ` Benjamin LaHaise
@ 2003-03-04 23:29         ` Martin J. Bligh
  2003-03-04 23:57         ` Dave Hansen
  1 sibling, 0 replies; 15+ messages in thread
From: Martin J. Bligh @ 2003-03-04 23:29 UTC (permalink / raw)
  To: Benjamin LaHaise; +Cc: Dave Hansen, Andrew Morton, linux-mm

> 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.

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 ;-)

> 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 majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] remove __pte_offset
  2003-03-04 23:26       ` Benjamin LaHaise
  2003-03-04 23:29         ` Martin J. Bligh
@ 2003-03-04 23:57         ` Dave Hansen
  2003-03-05  0:01           ` Andrew Morton
  1 sibling, 1 reply; 15+ messages in thread
From: Dave Hansen @ 2003-03-04 23:57 UTC (permalink / raw)
  To: Benjamin LaHaise; +Cc: Martin J. Bligh, Andrew Morton, linux-mm

Benjamin LaHaise wrote:
> On Tue, Mar 04, 2003 at 03:09:21PM -0800, Martin J. Bligh wrote:
> 
>>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?
> 
> 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.

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)

-- 
Dave Hansen
haveblue@us.ibm.com

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] remove __pte_offset
  2003-03-04 23:57         ` Dave Hansen
@ 2003-03-05  0:01           ` Andrew Morton
  2003-03-05  1:43             ` Martin J. Bligh
  0 siblings, 1 reply; 15+ messages in thread
From: Andrew Morton @ 2003-03-05  0:01 UTC (permalink / raw)
  To: Dave Hansen; +Cc: bcrl, mbligh, linux-mm

Dave Hansen <haveblue@us.ibm.com> wrote:
>
> 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 majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] remove __pte_offset
  2003-03-05  0:01           ` Andrew Morton
@ 2003-03-05  1:43             ` Martin J. Bligh
  2003-03-05  2:04               ` Andrew Morton
  0 siblings, 1 reply; 15+ messages in thread
From: Martin J. Bligh @ 2003-03-05  1:43 UTC (permalink / raw)
  To: Andrew Morton, Dave Hansen; +Cc: bcrl, linux-mm

>> 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 majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] remove __pte_offset
  2003-03-05  1:43             ` Martin J. Bligh
@ 2003-03-05  2:04               ` Andrew Morton
  2003-03-05  3:32                 ` Randy.Dunlap
  0 siblings, 1 reply; 15+ messages in thread
From: Andrew Morton @ 2003-03-05  2:04 UTC (permalink / raw)
  To: Martin J. Bligh; +Cc: haveblue, bcrl, linux-mm

"Martin J. Bligh" <mbligh@aracnet.com> wrote:
>
> >> 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 ...
> 

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 majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] remove __pte_offset
  2003-03-05  2:04               ` Andrew Morton
@ 2003-03-05  3:32                 ` Randy.Dunlap
  0 siblings, 0 replies; 15+ messages in thread
From: Randy.Dunlap @ 2003-03-05  3:32 UTC (permalink / raw)
  To: akpm; +Cc: mbligh, haveblue, bcrl, linux-mm

> "Martin J. Bligh" <mbligh@aracnet.com> wrote:
>>
>> >> 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 ...
>>
>
> Oh I agree that pte_index is 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 majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2003-03-05  3:32 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-04 23:00 [PATCH] remove __pgd_offset Dave Hansen
2003-03-04 23:02 ` [PATCH] remove __pmd_offset Dave Hansen
2003-03-04 23:03 ` [PATCH] remove __pte_offset Dave Hansen
2003-03-04 23:10   ` Benjamin LaHaise
2003-03-04 23:09     ` Martin J. Bligh
2003-03-04 23:22       ` Andrew Morton
2003-03-04 23:25       ` Dave Hansen
2003-03-04 23:26       ` Benjamin LaHaise
2003-03-04 23:29         ` Martin J. Bligh
2003-03-04 23:57         ` Dave Hansen
2003-03-05  0:01           ` Andrew Morton
2003-03-05  1:43             ` Martin J. Bligh
2003-03-05  2:04               ` Andrew Morton
2003-03-05  3:32                 ` Randy.Dunlap
2003-03-04 23:16     ` Dave Hansen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox