All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -mmotm] mm: unify some pmd_*() functions
@ 2009-01-25 21:35 ` Andrea Righi
  0 siblings, 0 replies; 18+ messages in thread
From: Andrea Righi @ 2009-01-25 21:35 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, linux-arch, linux-kernel, Andrea Righi

Unify all the identical implementations of pmd_free(), __pmd_free_tlb(),
pmd_alloc_one(), pmd_addr_end() in include/asm-generic/pgtable-nopmd.h

Signed-off-by: Andrea Righi <righi.andrea@gmail.com>
---
 include/asm-frv/pgalloc.h           |    9 +-------
 include/asm-generic/pgtable-nopmd.h |   36 ++++++++++++++++++++++++++++++----
 include/asm-m32r/pgalloc.h          |    9 +-------
 include/asm-m68k/motorola_pgalloc.h |    4 ++-
 include/asm-m68k/sun3_pgalloc.h     |   10 +--------
 5 files changed, 37 insertions(+), 31 deletions(-)

diff --git a/include/asm-frv/pgalloc.h b/include/asm-frv/pgalloc.h
index 971e6ad..c4be813 100644
--- a/include/asm-frv/pgalloc.h
+++ b/include/asm-frv/pgalloc.h
@@ -55,14 +55,7 @@ do {							\
 	tlb_remove_page((tlb),(pte));			\
 } while (0)
 
-/*
- * allocating and freeing a pmd is trivial: the 1-entry pmd is
- * inside the pgd, so has no extra memory associated with it.
- * (In the PAE case we free the pmds as part of the pgd.)
- */
-#define pmd_alloc_one(mm, addr)		({ BUG(); ((pmd_t *) 2); })
-#define pmd_free(mm, x)			do { } while (0)
-#define __pmd_free_tlb(tlb,x)		do { } while (0)
+#define pmd_alloc_one pmd_alloc_one_bug
 
 #endif /* CONFIG_MMU */
 
diff --git a/include/asm-generic/pgtable-nopmd.h b/include/asm-generic/pgtable-nopmd.h
index a7cdc48..b132d69 100644
--- a/include/asm-generic/pgtable-nopmd.h
+++ b/include/asm-generic/pgtable-nopmd.h
@@ -4,6 +4,7 @@
 #ifndef __ASSEMBLY__
 
 #include <asm-generic/pgtable-nopud.h>
+#include <asm/bug.h>
 
 struct mm_struct;
 
@@ -54,15 +55,40 @@ static inline pmd_t * pmd_offset(pud_t * pud, unsigned long address)
 /*
  * allocating and freeing a pmd is trivial: the 1-entry pmd is
  * inside the pud, so has no extra memory associated with it.
+ * (In the PAE case we free the pmds as part of the pgd.)
  */
-#define pmd_alloc_one(mm, address)		NULL
+#ifndef pmd_alloc_one
+static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
+{
+	return NULL;
+}
+#define pmd_alloc_one pmd_alloc_one
+#endif
+static inline pmd_t *pmd_alloc_one_bug(struct mm_struct *mm, unsigned long addr)
+{
+	BUG();
+	return (pmd_t *)(2);
+}
+#ifndef pmd_free
 static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
 {
 }
-#define __pmd_free_tlb(tlb, x)			do { } while (0)
-
-#undef  pmd_addr_end
-#define pmd_addr_end(addr, end)			(end)
+#define pmd_free pmd_free
+#endif
+#ifndef __pmd_free_tlb
+struct mmu_gather;
+static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd)
+{
+}
+#define __pmd_free_tlb __pmd_free_tlb
+#endif
+#ifndef pmd_addr_end
+static inline unsigned long pmd_addr_end(unsigned long addr, unsigned long end)
+{
+	return end;
+}
+#define pmd_addr_end pmd_addr_end
+#endif
 
 #endif /* __ASSEMBLY__ */
 
diff --git a/include/asm-m32r/pgalloc.h b/include/asm-m32r/pgalloc.h
index f11a2b9..b700896 100644
--- a/include/asm-m32r/pgalloc.h
+++ b/include/asm-m32r/pgalloc.h
@@ -60,15 +60,8 @@ static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
 
 #define __pte_free_tlb(tlb, pte)	pte_free((tlb)->mm, (pte))
 
-/*
- * allocating and freeing a pmd is trivial: the 1-entry pmd is
- * inside the pgd, so has no extra memory associated with it.
- * (In the PAE case we free the pmds as part of the pgd.)
- */
+#define pmd_alloc_one pmd_alloc_one_bug
 
-#define pmd_alloc_one(mm, addr)		({ BUG(); ((pmd_t *)2); })
-#define pmd_free(mm, x)			do { } while (0)
-#define __pmd_free_tlb(tlb, x)		do { } while (0)
 #define pgd_populate(mm, pmd, pte)	BUG()
 
 #define check_pgt_cache()	do { } while (0)
diff --git a/include/asm-m68k/motorola_pgalloc.h b/include/asm-m68k/motorola_pgalloc.h
index d08bf62..984436d 100644
--- a/include/asm-m68k/motorola_pgalloc.h
+++ b/include/asm-m68k/motorola_pgalloc.h
@@ -67,17 +67,19 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
 {
 	return get_pointer_table();
 }
+#define pmd_alloc_one pmd_alloc_one
 
 static inline int pmd_free(struct mm_struct *mm, pmd_t *pmd)
 {
 	return free_pointer_table(pmd);
 }
+#define pmd_free pmd_free
 
 static inline int __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd)
 {
 	return free_pointer_table(pmd);
 }
-
+#define __pmd_free_tlb __pmd_free_tlb
 
 static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
 {
diff --git a/include/asm-m68k/sun3_pgalloc.h b/include/asm-m68k/sun3_pgalloc.h
index d4c83f1..0fe28fc 100644
--- a/include/asm-m68k/sun3_pgalloc.h
+++ b/include/asm-m68k/sun3_pgalloc.h
@@ -18,8 +18,7 @@
 
 extern const char bad_pmd_string[];
 
-#define pmd_alloc_one(mm,address)       ({ BUG(); ((pmd_t *)2); })
-
+#define pmd_alloc_one pmd_alloc_one_bug
 
 static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
 {
@@ -75,13 +74,6 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, pgtable_t page
 }
 #define pmd_pgtable(pmd) pmd_page(pmd)
 
-/*
- * allocating and freeing a pmd is trivial: the 1-entry pmd is
- * inside the pgd, so has no extra memory associated with it.
- */
-#define pmd_free(mm, x)			do { } while (0)
-#define __pmd_free_tlb(tlb, x)		do { } while (0)
-
 static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
 {
         free_page((unsigned long) pgd);
-- 
1.5.6.3


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

* [PATCH -mmotm] mm: unify some pmd_*() functions
@ 2009-01-25 21:35 ` Andrea Righi
  0 siblings, 0 replies; 18+ messages in thread
From: Andrea Righi @ 2009-01-25 21:35 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, linux-arch, linux-kernel, Andrea Righi

Unify all the identical implementations of pmd_free(), __pmd_free_tlb(),
pmd_alloc_one(), pmd_addr_end() in include/asm-generic/pgtable-nopmd.h

Signed-off-by: Andrea Righi <righi.andrea@gmail.com>
---
 include/asm-frv/pgalloc.h           |    9 +-------
 include/asm-generic/pgtable-nopmd.h |   36 ++++++++++++++++++++++++++++++----
 include/asm-m32r/pgalloc.h          |    9 +-------
 include/asm-m68k/motorola_pgalloc.h |    4 ++-
 include/asm-m68k/sun3_pgalloc.h     |   10 +--------
 5 files changed, 37 insertions(+), 31 deletions(-)

diff --git a/include/asm-frv/pgalloc.h b/include/asm-frv/pgalloc.h
index 971e6ad..c4be813 100644
--- a/include/asm-frv/pgalloc.h
+++ b/include/asm-frv/pgalloc.h
@@ -55,14 +55,7 @@ do {							\
 	tlb_remove_page((tlb),(pte));			\
 } while (0)
 
-/*
- * allocating and freeing a pmd is trivial: the 1-entry pmd is
- * inside the pgd, so has no extra memory associated with it.
- * (In the PAE case we free the pmds as part of the pgd.)
- */
-#define pmd_alloc_one(mm, addr)		({ BUG(); ((pmd_t *) 2); })
-#define pmd_free(mm, x)			do { } while (0)
-#define __pmd_free_tlb(tlb,x)		do { } while (0)
+#define pmd_alloc_one pmd_alloc_one_bug
 
 #endif /* CONFIG_MMU */
 
diff --git a/include/asm-generic/pgtable-nopmd.h b/include/asm-generic/pgtable-nopmd.h
index a7cdc48..b132d69 100644
--- a/include/asm-generic/pgtable-nopmd.h
+++ b/include/asm-generic/pgtable-nopmd.h
@@ -4,6 +4,7 @@
 #ifndef __ASSEMBLY__
 
 #include <asm-generic/pgtable-nopud.h>
+#include <asm/bug.h>
 
 struct mm_struct;
 
@@ -54,15 +55,40 @@ static inline pmd_t * pmd_offset(pud_t * pud, unsigned long address)
 /*
  * allocating and freeing a pmd is trivial: the 1-entry pmd is
  * inside the pud, so has no extra memory associated with it.
+ * (In the PAE case we free the pmds as part of the pgd.)
  */
-#define pmd_alloc_one(mm, address)		NULL
+#ifndef pmd_alloc_one
+static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
+{
+	return NULL;
+}
+#define pmd_alloc_one pmd_alloc_one
+#endif
+static inline pmd_t *pmd_alloc_one_bug(struct mm_struct *mm, unsigned long addr)
+{
+	BUG();
+	return (pmd_t *)(2);
+}
+#ifndef pmd_free
 static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
 {
 }
-#define __pmd_free_tlb(tlb, x)			do { } while (0)
-
-#undef  pmd_addr_end
-#define pmd_addr_end(addr, end)			(end)
+#define pmd_free pmd_free
+#endif
+#ifndef __pmd_free_tlb
+struct mmu_gather;
+static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd)
+{
+}
+#define __pmd_free_tlb __pmd_free_tlb
+#endif
+#ifndef pmd_addr_end
+static inline unsigned long pmd_addr_end(unsigned long addr, unsigned long end)
+{
+	return end;
+}
+#define pmd_addr_end pmd_addr_end
+#endif
 
 #endif /* __ASSEMBLY__ */
 
diff --git a/include/asm-m32r/pgalloc.h b/include/asm-m32r/pgalloc.h
index f11a2b9..b700896 100644
--- a/include/asm-m32r/pgalloc.h
+++ b/include/asm-m32r/pgalloc.h
@@ -60,15 +60,8 @@ static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
 
 #define __pte_free_tlb(tlb, pte)	pte_free((tlb)->mm, (pte))
 
-/*
- * allocating and freeing a pmd is trivial: the 1-entry pmd is
- * inside the pgd, so has no extra memory associated with it.
- * (In the PAE case we free the pmds as part of the pgd.)
- */
+#define pmd_alloc_one pmd_alloc_one_bug
 
-#define pmd_alloc_one(mm, addr)		({ BUG(); ((pmd_t *)2); })
-#define pmd_free(mm, x)			do { } while (0)
-#define __pmd_free_tlb(tlb, x)		do { } while (0)
 #define pgd_populate(mm, pmd, pte)	BUG()
 
 #define check_pgt_cache()	do { } while (0)
diff --git a/include/asm-m68k/motorola_pgalloc.h b/include/asm-m68k/motorola_pgalloc.h
index d08bf62..984436d 100644
--- a/include/asm-m68k/motorola_pgalloc.h
+++ b/include/asm-m68k/motorola_pgalloc.h
@@ -67,17 +67,19 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
 {
 	return get_pointer_table();
 }
+#define pmd_alloc_one pmd_alloc_one
 
 static inline int pmd_free(struct mm_struct *mm, pmd_t *pmd)
 {
 	return free_pointer_table(pmd);
 }
+#define pmd_free pmd_free
 
 static inline int __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd)
 {
 	return free_pointer_table(pmd);
 }
-
+#define __pmd_free_tlb __pmd_free_tlb
 
 static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
 {
diff --git a/include/asm-m68k/sun3_pgalloc.h b/include/asm-m68k/sun3_pgalloc.h
index d4c83f1..0fe28fc 100644
--- a/include/asm-m68k/sun3_pgalloc.h
+++ b/include/asm-m68k/sun3_pgalloc.h
@@ -18,8 +18,7 @@
 
 extern const char bad_pmd_string[];
 
-#define pmd_alloc_one(mm,address)       ({ BUG(); ((pmd_t *)2); })
-
+#define pmd_alloc_one pmd_alloc_one_bug
 
 static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
 {
@@ -75,13 +74,6 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, pgtable_t page
 }
 #define pmd_pgtable(pmd) pmd_page(pmd)
 
-/*
- * allocating and freeing a pmd is trivial: the 1-entry pmd is
- * inside the pgd, so has no extra memory associated with it.
- */
-#define pmd_free(mm, x)			do { } while (0)
-#define __pmd_free_tlb(tlb, x)		do { } while (0)
-
 static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
 {
         free_page((unsigned long) pgd);
-- 
1.5.6.3

--
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:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH -mmotm] mm: unify some pmd_*() functions
  2009-01-25 21:35 ` Andrea Righi
@ 2009-01-25 21:39   ` Andrea Righi
  -1 siblings, 0 replies; 18+ messages in thread
From: Andrea Righi @ 2009-01-25 21:39 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, linux-arch, linux-kernel

On 2009-01-25 22:35, Andrea Righi wrote:
> Unify all the identical implementations of pmd_free(), __pmd_free_tlb(),
> pmd_alloc_one(), pmd_addr_end() in include/asm-generic/pgtable-nopmd.h
> 

BTW, I only tested this on x86 and x86_64. This needs more testing because it
touches also a lot of other architectures.

-Andrea

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

* Re: [PATCH -mmotm] mm: unify some pmd_*() functions
@ 2009-01-25 21:39   ` Andrea Righi
  0 siblings, 0 replies; 18+ messages in thread
From: Andrea Righi @ 2009-01-25 21:39 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, linux-arch, linux-kernel

On 2009-01-25 22:35, Andrea Righi wrote:
> Unify all the identical implementations of pmd_free(), __pmd_free_tlb(),
> pmd_alloc_one(), pmd_addr_end() in include/asm-generic/pgtable-nopmd.h
> 

BTW, I only tested this on x86 and x86_64. This needs more testing because it
touches also a lot of other architectures.

-Andrea

--
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:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH -mmotm] mm: unify some pmd_*() functions
  2009-01-25 21:35 ` Andrea Righi
  (?)
  (?)
@ 2009-01-28  1:41   ` Andrew Morton
  -1 siblings, 0 replies; 18+ messages in thread
From: Andrew Morton @ 2009-01-28  1:41 UTC (permalink / raw)
  To: Andrea Righi
  Cc: linux-mm, linux-arch, linux-kernel, righi.andrea,
	Geert Uytterhoeven, Roman Zippel, David Howells, Hirokazu Takata

On Sun, 25 Jan 2009 22:35:37 +0100
Andrea Righi <righi.andrea@gmail.com> wrote:

> diff --git a/include/asm-generic/pgtable-nopmd.h b/include/asm-generic/pgtable-nopmd.h
> index a7cdc48..b132d69 100644
> --- a/include/asm-generic/pgtable-nopmd.h
> +++ b/include/asm-generic/pgtable-nopmd.h
> @@ -4,6 +4,7 @@
>  #ifndef __ASSEMBLY__
>  
>  #include <asm-generic/pgtable-nopud.h>
> +#include <asm/bug.h>
>  
>  struct mm_struct;
>  

Why not include the preferred <linux/bug.h>?

> BTW, I only tested this on x86 and x86_64. This needs more testing because it
> touches also a lot of other architectures.

Hopefully Geert, Roman, David and Hirokazu Takata will have time to
help out here.

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

* Re: [PATCH -mmotm] mm: unify some pmd_*() functions
@ 2009-01-28  1:41   ` Andrew Morton
  0 siblings, 0 replies; 18+ messages in thread
From: Andrew Morton @ 2009-01-28  1:41 UTC (permalink / raw)
  Cc: linux-mm, linux-arch, linux-kernel, righi.andrea,
	Geert Uytterhoeven, Roman Zippel, David Howells, Hirokazu Takata

On Sun, 25 Jan 2009 22:35:37 +0100
Andrea Righi <righi.andrea@gmail.com> wrote:

> diff --git a/include/asm-generic/pgtable-nopmd.h b/include/asm-generic/pgtable-nopmd.h
> index a7cdc48..b132d69 100644
> --- a/include/asm-generic/pgtable-nopmd.h
> +++ b/include/asm-generic/pgtable-nopmd.h
> @@ -4,6 +4,7 @@
>  #ifndef __ASSEMBLY__
>  
>  #include <asm-generic/pgtable-nopud.h>
> +#include <asm/bug.h>
>  
>  struct mm_struct;
>  

Why not include the preferred <linux/bug.h>?

> BTW, I only tested this on x86 and x86_64. This needs more testing because it
> touches also a lot of other architectures.

Hopefully Geert, Roman, David and Hirokazu Takata will have time to
help out here.

--
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:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH -mmotm] mm: unify some pmd_*() functions
@ 2009-01-28  1:41   ` Andrew Morton
  0 siblings, 0 replies; 18+ messages in thread
From: Andrew Morton @ 2009-01-28  1:41 UTC (permalink / raw)
  To: Andrea Righi
  Cc: linux-mm, linux-arch, linux-kernel, Geert Uytterhoeven,
	Roman Zippel, David Howells, Hirokazu Takata

On Sun, 25 Jan 2009 22:35:37 +0100
Andrea Righi <righi.andrea@gmail.com> wrote:

> diff --git a/include/asm-generic/pgtable-nopmd.h b/include/asm-generic/pgtable-nopmd.h
> index a7cdc48..b132d69 100644
> --- a/include/asm-generic/pgtable-nopmd.h
> +++ b/include/asm-generic/pgtable-nopmd.h
> @@ -4,6 +4,7 @@
>  #ifndef __ASSEMBLY__
>  
>  #include <asm-generic/pgtable-nopud.h>
> +#include <asm/bug.h>
>  
>  struct mm_struct;
>  

Why not include the preferred <linux/bug.h>?

> BTW, I only tested this on x86 and x86_64. This needs more testing because it
> touches also a lot of other architectures.

Hopefully Geert, Roman, David and Hirokazu Takata will have time to
help out here.

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

* Re: [PATCH -mmotm] mm: unify some pmd_*() functions
@ 2009-01-28  1:41   ` Andrew Morton
  0 siblings, 0 replies; 18+ messages in thread
From: Andrew Morton @ 2009-01-28  1:41 UTC (permalink / raw)
  To: Andrea Righi
  Cc: linux-mm, linux-arch, linux-kernel, Geert Uytterhoeven,
	Roman Zippel, David Howells, Hirokazu Takata

On Sun, 25 Jan 2009 22:35:37 +0100
Andrea Righi <righi.andrea@gmail.com> wrote:

> diff --git a/include/asm-generic/pgtable-nopmd.h b/include/asm-generic/pgtable-nopmd.h
> index a7cdc48..b132d69 100644
> --- a/include/asm-generic/pgtable-nopmd.h
> +++ b/include/asm-generic/pgtable-nopmd.h
> @@ -4,6 +4,7 @@
>  #ifndef __ASSEMBLY__
>  
>  #include <asm-generic/pgtable-nopud.h>
> +#include <asm/bug.h>
>  
>  struct mm_struct;
>  

Why not include the preferred <linux/bug.h>?

> BTW, I only tested this on x86 and x86_64. This needs more testing because it
> touches also a lot of other architectures.

Hopefully Geert, Roman, David and Hirokazu Takata will have time to
help out here.

--
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:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH -mmotm] mm: unify some pmd_*() functions
  2009-01-28  1:41   ` Andrew Morton
@ 2009-01-28 17:59     ` Andrea Righi
  -1 siblings, 0 replies; 18+ messages in thread
From: Andrea Righi @ 2009-01-28 17:59 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-mm, linux-arch, linux-kernel, Geert Uytterhoeven,
	Roman Zippel, David Howells, Hirokazu Takata

On Wed, Jan 28, 2009 at 2:41 AM, Andrew Morton
<akpm@linux-foundation.org> wrote:
> On Sun, 25 Jan 2009 22:35:37 +0100
> Andrea Righi <righi.andrea@gmail.com> wrote:
>
>> diff --git a/include/asm-generic/pgtable-nopmd.h b/include/asm-generic/pgtable-nopmd.h
>> index a7cdc48..b132d69 100644
>> --- a/include/asm-generic/pgtable-nopmd.h
>> +++ b/include/asm-generic/pgtable-nopmd.h
>> @@ -4,6 +4,7 @@
>>  #ifndef __ASSEMBLY__
>>
>>  #include <asm-generic/pgtable-nopud.h>
>> +#include <asm/bug.h>
>>
>>  struct mm_struct;
>>
>
> Why not include the preferred <linux/bug.h>?

Using linux/bug.h leads to include hell (i.e. on x86 with
CONFIG_X86_PAE not set):
...
  CC      arch/x86/kernel/asm-offsets.s
In file included from include/linux/thread_info.h:55,
                 from include/linux/preempt.h:9,
                 from include/linux/spinlock.h:50,
                 from include/linux/seqlock.h:29,
                 from include/linux/time.h:8,
                 from include/linux/stat.h:60,
                 from include/linux/module.h:10,
                 from include/linux/bug.h:4,
                 from include/asm-generic/pgtable-nopmd.h:7,
                 from
/home/arighi/Software/linux/mmotm/arch/x86/include/asm/page.h:132,
                 from
/home/arighi/Software/linux/mmotm/arch/x86/include/asm/processor.h:18,
                 from
/home/arighi/Software/linux/mmotm/arch/x86/include/asm/atomic_32.h:6,
                 from
/home/arighi/Software/linux/mmotm/arch/x86/include/asm/atomic.h:2,
                 from include/linux/crypto.h:20,
                 from arch/x86/kernel/asm-offsets_32.c:7,
                 from arch/x86/kernel/asm-offsets.c:2:
/home/arighi/Software/linux/mmotm/arch/x86/include/asm/thread_info.h:34:
error: expected specifier-qualifier-list before 'mm_segment_t'
...

-Andrea

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

* Re: [PATCH -mmotm] mm: unify some pmd_*() functions
@ 2009-01-28 17:59     ` Andrea Righi
  0 siblings, 0 replies; 18+ messages in thread
From: Andrea Righi @ 2009-01-28 17:59 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-mm, linux-arch, linux-kernel, Geert Uytterhoeven,
	Roman Zippel, David Howells, Hirokazu Takata

On Wed, Jan 28, 2009 at 2:41 AM, Andrew Morton
<akpm@linux-foundation.org> wrote:
> On Sun, 25 Jan 2009 22:35:37 +0100
> Andrea Righi <righi.andrea@gmail.com> wrote:
>
>> diff --git a/include/asm-generic/pgtable-nopmd.h b/include/asm-generic/pgtable-nopmd.h
>> index a7cdc48..b132d69 100644
>> --- a/include/asm-generic/pgtable-nopmd.h
>> +++ b/include/asm-generic/pgtable-nopmd.h
>> @@ -4,6 +4,7 @@
>>  #ifndef __ASSEMBLY__
>>
>>  #include <asm-generic/pgtable-nopud.h>
>> +#include <asm/bug.h>
>>
>>  struct mm_struct;
>>
>
> Why not include the preferred <linux/bug.h>?

Using linux/bug.h leads to include hell (i.e. on x86 with
CONFIG_X86_PAE not set):
...
  CC      arch/x86/kernel/asm-offsets.s
In file included from include/linux/thread_info.h:55,
                 from include/linux/preempt.h:9,
                 from include/linux/spinlock.h:50,
                 from include/linux/seqlock.h:29,
                 from include/linux/time.h:8,
                 from include/linux/stat.h:60,
                 from include/linux/module.h:10,
                 from include/linux/bug.h:4,
                 from include/asm-generic/pgtable-nopmd.h:7,
                 from
/home/arighi/Software/linux/mmotm/arch/x86/include/asm/page.h:132,
                 from
/home/arighi/Software/linux/mmotm/arch/x86/include/asm/processor.h:18,
                 from
/home/arighi/Software/linux/mmotm/arch/x86/include/asm/atomic_32.h:6,
                 from
/home/arighi/Software/linux/mmotm/arch/x86/include/asm/atomic.h:2,
                 from include/linux/crypto.h:20,
                 from arch/x86/kernel/asm-offsets_32.c:7,
                 from arch/x86/kernel/asm-offsets.c:2:
/home/arighi/Software/linux/mmotm/arch/x86/include/asm/thread_info.h:34:
error: expected specifier-qualifier-list before 'mm_segment_t'
...

-Andrea

--
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:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH -mmotm] mm: unify some pmd_*() functions
  2009-01-28  1:41   ` Andrew Morton
@ 2009-01-29 20:02     ` Geert Uytterhoeven
  -1 siblings, 0 replies; 18+ messages in thread
From: Geert Uytterhoeven @ 2009-01-29 20:02 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Andrea Righi, linux-mm, linux-arch, linux-kernel, Roman Zippel,
	David Howells, Hirokazu Takata

On Tue, 27 Jan 2009, Andrew Morton wrote:
> On Sun, 25 Jan 2009 22:35:37 +0100
> Andrea Righi <righi.andrea@gmail.com> wrote:
> 
> > diff --git a/include/asm-generic/pgtable-nopmd.h b/include/asm-generic/pgtable-nopmd.h
> > index a7cdc48..b132d69 100644
> > --- a/include/asm-generic/pgtable-nopmd.h
> > +++ b/include/asm-generic/pgtable-nopmd.h
> > @@ -4,6 +4,7 @@
> >  #ifndef __ASSEMBLY__
> >  
> >  #include <asm-generic/pgtable-nopud.h>
> > +#include <asm/bug.h>
> >  
> >  struct mm_struct;
> >  
> 
> Why not include the preferred <linux/bug.h>?
> 
> > BTW, I only tested this on x86 and x86_64. This needs more testing because it
> > touches also a lot of other architectures.
> 
> Hopefully Geert, Roman, David and Hirokazu Takata will have time to
> help out here.

atari_defconfig builds fine and boots on ARAnyM.

sun3_defconfig fails with:

|   CC      mm/memory.o
| mm/memory.c: In function 'free_pmd_range':
| mm/memory.c:176: error: implicit declaration of function '__pmd_free_tlb'
| mm/memory.c: In function '__pmd_alloc':
| mm/memory.c:2903: error: implicit declaration of function 'pmd_alloc_one_bug'
| mm/memory.c:2903: warning: initialization makes pointer from integer without a cast
| mm/memory.c:2917: error: implicit declaration of function 'pmd_free'
| make[3]: *** [mm/memory.o] Error 1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* Re: [PATCH -mmotm] mm: unify some pmd_*() functions
@ 2009-01-29 20:02     ` Geert Uytterhoeven
  0 siblings, 0 replies; 18+ messages in thread
From: Geert Uytterhoeven @ 2009-01-29 20:02 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Andrea Righi, linux-mm, linux-arch, linux-kernel, Roman Zippel,
	David Howells, Hirokazu Takata

On Tue, 27 Jan 2009, Andrew Morton wrote:
> On Sun, 25 Jan 2009 22:35:37 +0100
> Andrea Righi <righi.andrea@gmail.com> wrote:
> 
> > diff --git a/include/asm-generic/pgtable-nopmd.h b/include/asm-generic/pgtable-nopmd.h
> > index a7cdc48..b132d69 100644
> > --- a/include/asm-generic/pgtable-nopmd.h
> > +++ b/include/asm-generic/pgtable-nopmd.h
> > @@ -4,6 +4,7 @@
> >  #ifndef __ASSEMBLY__
> >  
> >  #include <asm-generic/pgtable-nopud.h>
> > +#include <asm/bug.h>
> >  
> >  struct mm_struct;
> >  
> 
> Why not include the preferred <linux/bug.h>?
> 
> > BTW, I only tested this on x86 and x86_64. This needs more testing because it
> > touches also a lot of other architectures.
> 
> Hopefully Geert, Roman, David and Hirokazu Takata will have time to
> help out here.

atari_defconfig builds fine and boots on ARAnyM.

sun3_defconfig fails with:

|   CC      mm/memory.o
| mm/memory.c: In function 'free_pmd_range':
| mm/memory.c:176: error: implicit declaration of function '__pmd_free_tlb'
| mm/memory.c: In function '__pmd_alloc':
| mm/memory.c:2903: error: implicit declaration of function 'pmd_alloc_one_bug'
| mm/memory.c:2903: warning: initialization makes pointer from integer without a cast
| mm/memory.c:2917: error: implicit declaration of function 'pmd_free'
| make[3]: *** [mm/memory.o] Error 1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

--
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:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH -mmotm] mm: unify some pmd_*() functions
  2009-01-25 21:35 ` Andrea Righi
@ 2009-02-09 17:06   ` David Howells
  -1 siblings, 0 replies; 18+ messages in thread
From: David Howells @ 2009-02-09 17:06 UTC (permalink / raw)
  To: Andrea Righi; +Cc: dhowells, akpm, linux-mm, linux-arch, linux-kernel

Andrea Righi <righi.andrea@gmail.com> wrote:

> Unify all the identical implementations of pmd_free(), __pmd_free_tlb(),
> pmd_alloc_one(), pmd_addr_end() in include/asm-generic/pgtable-nopmd.h

NAK for FRV on two fronts:

 (1) The definition of pud_t in pgtable-nopud.h:

	typedef struct { pgd_t pgd; } pud_t;

     is not consistent with the one in FRV's page.h:

	typedef struct { unsigned long	ste[64];} pmd_t;
	typedef struct { pmd_t		pue[1]; } pud_t;
	typedef struct { pud_t		pge[1];	} pgd_t;

     The upper intermediate page table is contained within the page directory
     entry, not the other way around.  Having a pgd_t inside a pud_t is
     upside-down, illogical and makes things harder to follow IMNSHO.

 (2) It produces the following errors:

mm/memory.c: In function 'free_pmd_range':
mm/memory.c:176: error: implicit declaration of function '__pmd_free_tlb'
  CC      fs/seq_file.o
mm/memory.c: In function '__pmd_alloc':
mm/memory.c:2896: error: implicit declaration of function 'pmd_alloc_one_bug'
mm/memory.c:2896: warning: initialization makes pointer from integer without a cast
mm/memory.c:2905: error: implicit declaration of function 'pmd_free'

David

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

* Re: [PATCH -mmotm] mm: unify some pmd_*() functions
@ 2009-02-09 17:06   ` David Howells
  0 siblings, 0 replies; 18+ messages in thread
From: David Howells @ 2009-02-09 17:06 UTC (permalink / raw)
  To: Andrea Righi; +Cc: dhowells, akpm, linux-mm, linux-arch, linux-kernel

Andrea Righi <righi.andrea@gmail.com> wrote:

> Unify all the identical implementations of pmd_free(), __pmd_free_tlb(),
> pmd_alloc_one(), pmd_addr_end() in include/asm-generic/pgtable-nopmd.h

NAK for FRV on two fronts:

 (1) The definition of pud_t in pgtable-nopud.h:

	typedef struct { pgd_t pgd; } pud_t;

     is not consistent with the one in FRV's page.h:

	typedef struct { unsigned long	ste[64];} pmd_t;
	typedef struct { pmd_t		pue[1]; } pud_t;
	typedef struct { pud_t		pge[1];	} pgd_t;

     The upper intermediate page table is contained within the page directory
     entry, not the other way around.  Having a pgd_t inside a pud_t is
     upside-down, illogical and makes things harder to follow IMNSHO.

 (2) It produces the following errors:

mm/memory.c: In function 'free_pmd_range':
mm/memory.c:176: error: implicit declaration of function '__pmd_free_tlb'
  CC      fs/seq_file.o
mm/memory.c: In function '__pmd_alloc':
mm/memory.c:2896: error: implicit declaration of function 'pmd_alloc_one_bug'
mm/memory.c:2896: warning: initialization makes pointer from integer without a cast
mm/memory.c:2905: error: implicit declaration of function 'pmd_free'

David

--
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:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH -mmotm] mm: unify some pmd_*() functions
  2009-02-09 17:06   ` David Howells
@ 2009-02-10 13:41     ` Andrea Righi
  -1 siblings, 0 replies; 18+ messages in thread
From: Andrea Righi @ 2009-02-10 13:41 UTC (permalink / raw)
  To: David Howells; +Cc: akpm, linux-mm, linux-arch, linux-kernel

On Mon, Feb 9, 2009 at 6:06 PM, David Howells <dhowells@redhat.com> wrote:
> Andrea Righi <righi.andrea@gmail.com> wrote:
>
>> Unify all the identical implementations of pmd_free(), __pmd_free_tlb(),
>> pmd_alloc_one(), pmd_addr_end() in include/asm-generic/pgtable-nopmd.h
>
> NAK for FRV on two fronts:

This patch generates too many followup fixes and it's better to simply drop it
for now.

I think we need to use a different approach and, more important, we need to
clean a lot of .h files before to avoid the include hell problems.

-Andrea

>
>  (1) The definition of pud_t in pgtable-nopud.h:
>
>        typedef struct { pgd_t pgd; } pud_t;
>
>     is not consistent with the one in FRV's page.h:
>
>        typedef struct { unsigned long  ste[64];} pmd_t;
>        typedef struct { pmd_t          pue[1]; } pud_t;
>        typedef struct { pud_t          pge[1]; } pgd_t;
>
>     The upper intermediate page table is contained within the page directory
>     entry, not the other way around.  Having a pgd_t inside a pud_t is
>     upside-down, illogical and makes things harder to follow IMNSHO.
>
>  (2) It produces the following errors:
>
> mm/memory.c: In function 'free_pmd_range':
> mm/memory.c:176: error: implicit declaration of function '__pmd_free_tlb'
>  CC      fs/seq_file.o
> mm/memory.c: In function '__pmd_alloc':
> mm/memory.c:2896: error: implicit declaration of function 'pmd_alloc_one_bug'
> mm/memory.c:2896: warning: initialization makes pointer from integer without a cast
> mm/memory.c:2905: error: implicit declaration of function 'pmd_free'
>
> David

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

* Re: [PATCH -mmotm] mm: unify some pmd_*() functions
@ 2009-02-10 13:41     ` Andrea Righi
  0 siblings, 0 replies; 18+ messages in thread
From: Andrea Righi @ 2009-02-10 13:41 UTC (permalink / raw)
  To: David Howells; +Cc: akpm, linux-mm, linux-arch, linux-kernel

On Mon, Feb 9, 2009 at 6:06 PM, David Howells <dhowells@redhat.com> wrote:
> Andrea Righi <righi.andrea@gmail.com> wrote:
>
>> Unify all the identical implementations of pmd_free(), __pmd_free_tlb(),
>> pmd_alloc_one(), pmd_addr_end() in include/asm-generic/pgtable-nopmd.h
>
> NAK for FRV on two fronts:

This patch generates too many followup fixes and it's better to simply drop it
for now.

I think we need to use a different approach and, more important, we need to
clean a lot of .h files before to avoid the include hell problems.

-Andrea

>
>  (1) The definition of pud_t in pgtable-nopud.h:
>
>        typedef struct { pgd_t pgd; } pud_t;
>
>     is not consistent with the one in FRV's page.h:
>
>        typedef struct { unsigned long  ste[64];} pmd_t;
>        typedef struct { pmd_t          pue[1]; } pud_t;
>        typedef struct { pud_t          pge[1]; } pgd_t;
>
>     The upper intermediate page table is contained within the page directory
>     entry, not the other way around.  Having a pgd_t inside a pud_t is
>     upside-down, illogical and makes things harder to follow IMNSHO.
>
>  (2) It produces the following errors:
>
> mm/memory.c: In function 'free_pmd_range':
> mm/memory.c:176: error: implicit declaration of function '__pmd_free_tlb'
>  CC      fs/seq_file.o
> mm/memory.c: In function '__pmd_alloc':
> mm/memory.c:2896: error: implicit declaration of function 'pmd_alloc_one_bug'
> mm/memory.c:2896: warning: initialization makes pointer from integer without a cast
> mm/memory.c:2905: error: implicit declaration of function 'pmd_free'
>
> David

--
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:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH -mmotm] mm: unify some pmd_*() functions
  2009-02-10 13:41     ` Andrea Righi
@ 2009-02-11 10:16       ` Martin Schwidefsky
  -1 siblings, 0 replies; 18+ messages in thread
From: Martin Schwidefsky @ 2009-02-11 10:16 UTC (permalink / raw)
  To: Andrea Righi; +Cc: David Howells, akpm, linux-mm, linux-arch, linux-kernel

On Tue, 2009-02-10 at 14:41 +0100, Andrea Righi wrote: 
> On Mon, Feb 9, 2009 at 6:06 PM, David Howells <dhowells@redhat.com> wrote:
> > Andrea Righi <righi.andrea@gmail.com> wrote:
> >
> >> Unify all the identical implementations of pmd_free(), __pmd_free_tlb(),
> >> pmd_alloc_one(), pmd_addr_end() in include/asm-generic/pgtable-nopmd.h
> >
> > NAK for FRV on two fronts:
> 
> This patch generates too many followup fixes and it's better to simply drop it
> for now.
> 
> I think we need to use a different approach and, more important, we need to
> clean a lot of .h files before to avoid the include hell problems.

I'm in favour of getting rid of include/asm-generic/pgtable-nopmd.h and
include/asm-generic/pgtable-nopud.h altogether. The folding of page
table levels is hard enough to understand but with the definitions
scattered in five different files it is no fun. At least my brain starts
to hurt everytime I have to look at an architecture that uses the
generic folding. As an example I hacked together the conversion for
sparc64. It compiles, dunno if it works.

-- 
blue skies,
  Martin.

"Reality continues to ruin my life." - Calvin.


---
diff -urpN linux-2.6/arch/sparc/include/asm/page_64.h linux-2.6-example/arch/sparc/include/asm/page_64.h
--- linux-2.6/arch/sparc/include/asm/page_64.h	2008-10-12 22:12:26.000000000 +0200
+++ linux-2.6-example/arch/sparc/include/asm/page_64.h	2009-02-11 11:03:56.000000000 +0100
@@ -61,18 +61,21 @@ extern void copy_user_page(void *to, voi
 typedef struct { unsigned long pte; } pte_t;
 typedef struct { unsigned long iopte; } iopte_t;
 typedef struct { unsigned int pmd; } pmd_t;
+typedef struct { unsigned int pud; } pud_t;
 typedef struct { unsigned int pgd; } pgd_t;
 typedef struct { unsigned long pgprot; } pgprot_t;
 
 #define pte_val(x)	((x).pte)
 #define iopte_val(x)	((x).iopte)
 #define pmd_val(x)      ((x).pmd)
+#define pud_val(x)	((x).pud)
 #define pgd_val(x)	((x).pgd)
 #define pgprot_val(x)	((x).pgprot)
 
 #define __pte(x)	((pte_t) { (x) } )
 #define __iopte(x)	((iopte_t) { (x) } )
 #define __pmd(x)        ((pmd_t) { (x) } )
+#define __pud(x)	((pud_t) { (x) } )
 #define __pgd(x)	((pgd_t) { (x) } )
 #define __pgprot(x)	((pgprot_t) { (x) } )
 
diff -urpN linux-2.6/arch/sparc/include/asm/pgalloc_64.h linux-2.6-example/arch/sparc/include/asm/pgalloc_64.h
--- linux-2.6/arch/sparc/include/asm/pgalloc_64.h	2008-07-29 10:11:30.000000000 +0200
+++ linux-2.6-example/arch/sparc/include/asm/pgalloc_64.h	2009-02-11 11:11:29.000000000 +0100
@@ -24,6 +24,12 @@ static inline void pgd_free(struct mm_st
 	quicklist_free(0, NULL, pgd);
 }
 
+#define pgd_populate(mm, pgd, pud)	do { } while (0)
+
+#define pud_alloc_one(mm, address)	(NULL)
+#define pud_free(mm, x)			do { } while (0)
+#define __pud_free_tlb(tlb, x)		do { } while (0)
+
 #define pud_populate(MM, PUD, PMD)	pud_set(PUD, PMD)
 
 static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
diff -urpN linux-2.6/arch/sparc/include/asm/pgtable_64.h linux-2.6-example/arch/sparc/include/asm/pgtable_64.h
--- linux-2.6/arch/sparc/include/asm/pgtable_64.h	2008-10-12 22:12:26.000000000 +0200
+++ linux-2.6-example/arch/sparc/include/asm/pgtable_64.h	2009-02-11 11:07:00.000000000 +0100
@@ -12,8 +12,6 @@
  * the SpitFire page tables.
  */
 
-#include <asm-generic/pgtable-nopud.h>
-
 #include <linux/compiler.h>
 #include <linux/const.h>
 #include <asm/types.h>
@@ -68,6 +66,11 @@
 #define PMD_MASK	(~(PMD_SIZE-1))
 #define PMD_BITS	(PAGE_SHIFT - 2)
 
+#define PUD_SHIFT	(PAGE_SHIFT + (PAGE_SHIFT-3) + PMD_BITS)
+#define PUD_SIZE	(_AC(1,UL) << PUD_SHIFT)
+#define PUD_MASK	(~(PUD_SIZE-1))
+#define PUD_BITS	(PAGE_SHIFT - 2)
+
 /* PGDIR_SHIFT determines what a third-level page table entry can map */
 #define PGDIR_SHIFT	(PAGE_SHIFT + (PAGE_SHIFT-3) + PMD_BITS)
 #define PGDIR_SIZE	(_AC(1,UL) << PGDIR_SHIFT)
@@ -81,6 +84,7 @@
 /* Entries per page directory level. */
 #define PTRS_PER_PTE	(1UL << (PAGE_SHIFT-3))
 #define PTRS_PER_PMD	(1UL << PMD_BITS)
+#define PTRS_PER_PUD	(1UL)
 #define PTRS_PER_PGD	(1UL << PGDIR_BITS)
 
 /* Kernel has a separate 44bit address space. */
@@ -88,6 +92,7 @@
 
 #define pte_ERROR(e)	__builtin_trap()
 #define pmd_ERROR(e)	__builtin_trap()
+#define pud_ERROR(e)	__builtin_trap()
 #define pgd_ERROR(e)	__builtin_trap()
 
 #endif /* !(__ASSEMBLY__) */
@@ -630,6 +635,10 @@ static inline int pte_special(pte_t pte)
 #define pud_bad(pud)			(0)
 #define pud_present(pud)		(pud_val(pud) != 0U)
 #define pud_clear(pudp)			(pud_val(*(pudp)) = 0U)
+#define pgd_none(pgd)			(0)
+#define pgd_bad(pgd)			(0)
+#define pgd_present(pgd)		(1)
+#define pgd_clear(pgd)			do { } while (0)
 
 /* Same in both SUN4V and SUN4U.  */
 #define pte_none(pte) 			(!pte_val(pte))
@@ -641,6 +650,8 @@ static inline int pte_special(pte_t pte)
 /* to find an entry in a kernel page-table-directory */
 #define pgd_offset_k(address) pgd_offset(&init_mm, address)
 
+#define pud_offset(pgdp, address) ((pud_t *) pgdp)
+
 /* Find an entry in the second-level page table.. */
 #define pmd_offset(pudp, address)	\
 	((pmd_t *) pud_page_vaddr(*(pudp)) + \



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

* Re: [PATCH -mmotm] mm: unify some pmd_*() functions
@ 2009-02-11 10:16       ` Martin Schwidefsky
  0 siblings, 0 replies; 18+ messages in thread
From: Martin Schwidefsky @ 2009-02-11 10:16 UTC (permalink / raw)
  To: Andrea Righi; +Cc: David Howells, akpm, linux-mm, linux-arch, linux-kernel

On Tue, 2009-02-10 at 14:41 +0100, Andrea Righi wrote: 
> On Mon, Feb 9, 2009 at 6:06 PM, David Howells <dhowells@redhat.com> wrote:
> > Andrea Righi <righi.andrea@gmail.com> wrote:
> >
> >> Unify all the identical implementations of pmd_free(), __pmd_free_tlb(),
> >> pmd_alloc_one(), pmd_addr_end() in include/asm-generic/pgtable-nopmd.h
> >
> > NAK for FRV on two fronts:
> 
> This patch generates too many followup fixes and it's better to simply drop it
> for now.
> 
> I think we need to use a different approach and, more important, we need to
> clean a lot of .h files before to avoid the include hell problems.

I'm in favour of getting rid of include/asm-generic/pgtable-nopmd.h and
include/asm-generic/pgtable-nopud.h altogether. The folding of page
table levels is hard enough to understand but with the definitions
scattered in five different files it is no fun. At least my brain starts
to hurt everytime I have to look at an architecture that uses the
generic folding. As an example I hacked together the conversion for
sparc64. It compiles, dunno if it works.

-- 
blue skies,
  Martin.

"Reality continues to ruin my life." - Calvin.


---
diff -urpN linux-2.6/arch/sparc/include/asm/page_64.h linux-2.6-example/arch/sparc/include/asm/page_64.h
--- linux-2.6/arch/sparc/include/asm/page_64.h	2008-10-12 22:12:26.000000000 +0200
+++ linux-2.6-example/arch/sparc/include/asm/page_64.h	2009-02-11 11:03:56.000000000 +0100
@@ -61,18 +61,21 @@ extern void copy_user_page(void *to, voi
 typedef struct { unsigned long pte; } pte_t;
 typedef struct { unsigned long iopte; } iopte_t;
 typedef struct { unsigned int pmd; } pmd_t;
+typedef struct { unsigned int pud; } pud_t;
 typedef struct { unsigned int pgd; } pgd_t;
 typedef struct { unsigned long pgprot; } pgprot_t;
 
 #define pte_val(x)	((x).pte)
 #define iopte_val(x)	((x).iopte)
 #define pmd_val(x)      ((x).pmd)
+#define pud_val(x)	((x).pud)
 #define pgd_val(x)	((x).pgd)
 #define pgprot_val(x)	((x).pgprot)
 
 #define __pte(x)	((pte_t) { (x) } )
 #define __iopte(x)	((iopte_t) { (x) } )
 #define __pmd(x)        ((pmd_t) { (x) } )
+#define __pud(x)	((pud_t) { (x) } )
 #define __pgd(x)	((pgd_t) { (x) } )
 #define __pgprot(x)	((pgprot_t) { (x) } )
 
diff -urpN linux-2.6/arch/sparc/include/asm/pgalloc_64.h linux-2.6-example/arch/sparc/include/asm/pgalloc_64.h
--- linux-2.6/arch/sparc/include/asm/pgalloc_64.h	2008-07-29 10:11:30.000000000 +0200
+++ linux-2.6-example/arch/sparc/include/asm/pgalloc_64.h	2009-02-11 11:11:29.000000000 +0100
@@ -24,6 +24,12 @@ static inline void pgd_free(struct mm_st
 	quicklist_free(0, NULL, pgd);
 }
 
+#define pgd_populate(mm, pgd, pud)	do { } while (0)
+
+#define pud_alloc_one(mm, address)	(NULL)
+#define pud_free(mm, x)			do { } while (0)
+#define __pud_free_tlb(tlb, x)		do { } while (0)
+
 #define pud_populate(MM, PUD, PMD)	pud_set(PUD, PMD)
 
 static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
diff -urpN linux-2.6/arch/sparc/include/asm/pgtable_64.h linux-2.6-example/arch/sparc/include/asm/pgtable_64.h
--- linux-2.6/arch/sparc/include/asm/pgtable_64.h	2008-10-12 22:12:26.000000000 +0200
+++ linux-2.6-example/arch/sparc/include/asm/pgtable_64.h	2009-02-11 11:07:00.000000000 +0100
@@ -12,8 +12,6 @@
  * the SpitFire page tables.
  */
 
-#include <asm-generic/pgtable-nopud.h>
-
 #include <linux/compiler.h>
 #include <linux/const.h>
 #include <asm/types.h>
@@ -68,6 +66,11 @@
 #define PMD_MASK	(~(PMD_SIZE-1))
 #define PMD_BITS	(PAGE_SHIFT - 2)
 
+#define PUD_SHIFT	(PAGE_SHIFT + (PAGE_SHIFT-3) + PMD_BITS)
+#define PUD_SIZE	(_AC(1,UL) << PUD_SHIFT)
+#define PUD_MASK	(~(PUD_SIZE-1))
+#define PUD_BITS	(PAGE_SHIFT - 2)
+
 /* PGDIR_SHIFT determines what a third-level page table entry can map */
 #define PGDIR_SHIFT	(PAGE_SHIFT + (PAGE_SHIFT-3) + PMD_BITS)
 #define PGDIR_SIZE	(_AC(1,UL) << PGDIR_SHIFT)
@@ -81,6 +84,7 @@
 /* Entries per page directory level. */
 #define PTRS_PER_PTE	(1UL << (PAGE_SHIFT-3))
 #define PTRS_PER_PMD	(1UL << PMD_BITS)
+#define PTRS_PER_PUD	(1UL)
 #define PTRS_PER_PGD	(1UL << PGDIR_BITS)
 
 /* Kernel has a separate 44bit address space. */
@@ -88,6 +92,7 @@
 
 #define pte_ERROR(e)	__builtin_trap()
 #define pmd_ERROR(e)	__builtin_trap()
+#define pud_ERROR(e)	__builtin_trap()
 #define pgd_ERROR(e)	__builtin_trap()
 
 #endif /* !(__ASSEMBLY__) */
@@ -630,6 +635,10 @@ static inline int pte_special(pte_t pte)
 #define pud_bad(pud)			(0)
 #define pud_present(pud)		(pud_val(pud) != 0U)
 #define pud_clear(pudp)			(pud_val(*(pudp)) = 0U)
+#define pgd_none(pgd)			(0)
+#define pgd_bad(pgd)			(0)
+#define pgd_present(pgd)		(1)
+#define pgd_clear(pgd)			do { } while (0)
 
 /* Same in both SUN4V and SUN4U.  */
 #define pte_none(pte) 			(!pte_val(pte))
@@ -641,6 +650,8 @@ static inline int pte_special(pte_t pte)
 /* to find an entry in a kernel page-table-directory */
 #define pgd_offset_k(address) pgd_offset(&init_mm, address)
 
+#define pud_offset(pgdp, address) ((pud_t *) pgdp)
+
 /* Find an entry in the second-level page table.. */
 #define pmd_offset(pudp, address)	\
 	((pmd_t *) pud_page_vaddr(*(pudp)) + \


--
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:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2009-02-11 10:17 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-25 21:35 [PATCH -mmotm] mm: unify some pmd_*() functions Andrea Righi
2009-01-25 21:35 ` Andrea Righi
2009-01-25 21:39 ` Andrea Righi
2009-01-25 21:39   ` Andrea Righi
2009-01-28  1:41 ` Andrew Morton
2009-01-28  1:41   ` Andrew Morton
2009-01-28  1:41   ` Andrew Morton
2009-01-28  1:41   ` Andrew Morton
2009-01-28 17:59   ` Andrea Righi
2009-01-28 17:59     ` Andrea Righi
2009-01-29 20:02   ` Geert Uytterhoeven
2009-01-29 20:02     ` Geert Uytterhoeven
2009-02-09 17:06 ` David Howells
2009-02-09 17:06   ` David Howells
2009-02-10 13:41   ` Andrea Righi
2009-02-10 13:41     ` Andrea Righi
2009-02-11 10:16     ` Martin Schwidefsky
2009-02-11 10:16       ` Martin Schwidefsky

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.