Linux MIPS Architecture development
 help / color / mirror / Atom feed
* Re: [PATCH] 16K page size in 32 bit kernel
  2007-07-31 13:09 [PATCH] 16K page size in 32 bit kernel Dajie Tan
@ 2007-07-31  9:37 ` Songmao Tian
  2007-07-31  9:37   ` Songmao Tian
  2007-07-31 10:00 ` Ralf Baechle
  1 sibling, 1 reply; 7+ messages in thread
From: Songmao Tian @ 2007-07-31  9:37 UTC (permalink / raw)
  Cc: Ralf Baechle, linux-mips

Thanks Dajie:)

With 22 PGDIR_SHIFT, 15 extra page tables is populated when a whole 64M 
address space is accessed, the patch can save memory quite a bit:)

Dajie Tan wrote:
> 32-bit Kernel for loongson2e currently use 16KB page size to avoid
> cache alias problem.So, the definiton of PGDIR_SHIFT muse be 12+14.
>
> Using 22 in 16K page size do not lead to a serious problem but the number
> of pages allocated for page table is more than previous. (cat
> /proc/vmstat | grep nr_page_table_pages)
>
> It's been tested on FuLong mini PC(loongson2e inside).
>
>
> Signed-off-by: Dajie Tan <jiankemeng@gmail.com>
> ---
>  include/asm-mips/pgtable-32.h |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/include/asm-mips/pgtable-32.h b/include/asm-mips/pgtable-32.h
> index 2fbd47e..8d34ebf 100644
> --- a/include/asm-mips/pgtable-32.h
> +++ b/include/asm-mips/pgtable-32.h
> @@ -46,7 +46,7 @@ extern int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1,
>  #ifdef CONFIG_64BIT_PHYS_ADDR
>  #define PGDIR_SHIFT	21
>  #else
> -#define PGDIR_SHIFT	22
> +#define PGDIR_SHIFT	(PAGE_SHIFT + (PAGE_SHIFT + PTE_ORDER - 2))
>  #endif
>  #define PGDIR_SIZE	(1UL << PGDIR_SHIFT)
>  #define PGDIR_MASK	(~(PGDIR_SIZE-1))
>
>
>
>
>   

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

* Re: [PATCH] 16K page size in 32 bit kernel
  2007-07-31  9:37 ` Songmao Tian
@ 2007-07-31  9:37   ` Songmao Tian
  0 siblings, 0 replies; 7+ messages in thread
From: Songmao Tian @ 2007-07-31  9:37 UTC (permalink / raw)
  Cc: Ralf Baechle, linux-mips

Thanks Dajie:)

With 22 PGDIR_SHIFT, 15 extra page tables is populated when a whole 64M 
address space is accessed, the patch can save memory quite a bit:)

Dajie Tan wrote:
> 32-bit Kernel for loongson2e currently use 16KB page size to avoid
> cache alias problem.So, the definiton of PGDIR_SHIFT muse be 12+14.
>
> Using 22 in 16K page size do not lead to a serious problem but the number
> of pages allocated for page table is more than previous. (cat
> /proc/vmstat | grep nr_page_table_pages)
>
> It's been tested on FuLong mini PC(loongson2e inside).
>
>
> Signed-off-by: Dajie Tan <jiankemeng@gmail.com>
> ---
>  include/asm-mips/pgtable-32.h |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/include/asm-mips/pgtable-32.h b/include/asm-mips/pgtable-32.h
> index 2fbd47e..8d34ebf 100644
> --- a/include/asm-mips/pgtable-32.h
> +++ b/include/asm-mips/pgtable-32.h
> @@ -46,7 +46,7 @@ extern int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1,
>  #ifdef CONFIG_64BIT_PHYS_ADDR
>  #define PGDIR_SHIFT	21
>  #else
> -#define PGDIR_SHIFT	22
> +#define PGDIR_SHIFT	(PAGE_SHIFT + (PAGE_SHIFT + PTE_ORDER - 2))
>  #endif
>  #define PGDIR_SIZE	(1UL << PGDIR_SHIFT)
>  #define PGDIR_MASK	(~(PGDIR_SIZE-1))
>
>
>
>
>   

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

* Re: [PATCH] 16K page size in 32 bit kernel
  2007-07-31 13:09 [PATCH] 16K page size in 32 bit kernel Dajie Tan
  2007-07-31  9:37 ` Songmao Tian
@ 2007-07-31 10:00 ` Ralf Baechle
  2007-07-31 13:49   ` Songmao Tian
  1 sibling, 1 reply; 7+ messages in thread
From: Ralf Baechle @ 2007-07-31 10:00 UTC (permalink / raw)
  To: Dajie Tan; +Cc: linux-mips

On Tue, Jul 31, 2007 at 05:09:51PM +0400, Dajie Tan wrote:

> 32-bit Kernel for loongson2e currently use 16KB page size to avoid
> cache alias problem.So, the definiton of PGDIR_SHIFT muse be 12+14.
> 
> Using 22 in 16K page size do not lead to a serious problem but the number
> of pages allocated for page table is more than previous. (cat
> /proc/vmstat | grep nr_page_table_pages)
> 
> It's been tested on FuLong mini PC(loongson2e inside).

Looking good, applied.  Thanks!

Did by coincidence any of you try 64K pages with a 32-bit kernel?

  Ralf

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

* [PATCH] 16K page size in 32 bit kernel
@ 2007-07-31 13:09 Dajie Tan
  2007-07-31  9:37 ` Songmao Tian
  2007-07-31 10:00 ` Ralf Baechle
  0 siblings, 2 replies; 7+ messages in thread
From: Dajie Tan @ 2007-07-31 13:09 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: linux-mips


32-bit Kernel for loongson2e currently use 16KB page size to avoid
cache alias problem.So, the definiton of PGDIR_SHIFT muse be 12+14.

Using 22 in 16K page size do not lead to a serious problem but the number
of pages allocated for page table is more than previous. (cat
/proc/vmstat | grep nr_page_table_pages)

It's been tested on FuLong mini PC(loongson2e inside).


Signed-off-by: Dajie Tan <jiankemeng@gmail.com>
---
 include/asm-mips/pgtable-32.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/asm-mips/pgtable-32.h b/include/asm-mips/pgtable-32.h
index 2fbd47e..8d34ebf 100644
--- a/include/asm-mips/pgtable-32.h
+++ b/include/asm-mips/pgtable-32.h
@@ -46,7 +46,7 @@ extern int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1,
 #ifdef CONFIG_64BIT_PHYS_ADDR
 #define PGDIR_SHIFT	21
 #else
-#define PGDIR_SHIFT	22
+#define PGDIR_SHIFT	(PAGE_SHIFT + (PAGE_SHIFT + PTE_ORDER - 2))
 #endif
 #define PGDIR_SIZE	(1UL << PGDIR_SHIFT)
 #define PGDIR_MASK	(~(PGDIR_SIZE-1))

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

* Re: [PATCH] 16K page size in 32 bit kernel
  2007-07-31 10:00 ` Ralf Baechle
@ 2007-07-31 13:49   ` Songmao Tian
  2007-07-31 20:45     ` Ralf Baechle
  0 siblings, 1 reply; 7+ messages in thread
From: Songmao Tian @ 2007-07-31 13:49 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: Dajie Tan, linux-mips

Ralf Baechle wrote:
> On Tue, Jul 31, 2007 at 05:09:51PM +0400, Dajie Tan wrote:
>
>   
>> 32-bit Kernel for loongson2e currently use 16KB page size to avoid
>> cache alias problem.So, the definiton of PGDIR_SHIFT muse be 12+14.
>>
>> Using 22 in 16K page size do not lead to a serious problem but the number
>> of pages allocated for page table is more than previous. (cat
>> /proc/vmstat | grep nr_page_table_pages)
>>
>> It's been tested on FuLong mini PC(loongson2e inside).
>>     
>
> Looking good, applied.  Thanks!
>
> Did by coincidence any of you try 64K pages with a 32-bit kernel?
>
>   Ralf
>
>
>
>   
I think the following is more complete?

 #ifdef CONFIG_64BIT_PHYS_ADDR
-#define PGDIR_SHIFT    21
+#define PGDIR_SHIFT    (PAGE_SHIFT + (PAGE_SHIFT + PTE_ORDER - 3))
 #else
-#define PGDIR_SHIFT    22
+#define PGDIR_SHIFT    (PAGE_SHIFT + (PAGE_SHIFT + PTE_ORDER - 2))
 #endif

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

* Re: [PATCH] 16K page size in 32 bit kernel
  2007-07-31 13:49   ` Songmao Tian
@ 2007-07-31 20:45     ` Ralf Baechle
  2007-08-01  0:47       ` Songmao Tian
  0 siblings, 1 reply; 7+ messages in thread
From: Ralf Baechle @ 2007-07-31 20:45 UTC (permalink / raw)
  To: Songmao Tian; +Cc: Dajie Tan, linux-mips

On Tue, Jul 31, 2007 at 09:49:34PM +0800, Songmao Tian wrote:

> I think the following is more complete?
> 
> #ifdef CONFIG_64BIT_PHYS_ADDR
> -#define PGDIR_SHIFT    21
> +#define PGDIR_SHIFT    (PAGE_SHIFT + (PAGE_SHIFT + PTE_ORDER - 3))
> #else
> -#define PGDIR_SHIFT    22
> +#define PGDIR_SHIFT    (PAGE_SHIFT + (PAGE_SHIFT + PTE_ORDER - 2))
> #endif

Better suggestion :-)

  Ralf

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

diff --git a/include/asm-mips/pgtable-32.h b/include/asm-mips/pgtable-32.h
index 2fbd47e..ff29485 100644
--- a/include/asm-mips/pgtable-32.h
+++ b/include/asm-mips/pgtable-32.h
@@ -43,11 +43,7 @@ extern int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1,
  */
 
 /* PGDIR_SHIFT determines what a third-level page table entry can map */
-#ifdef CONFIG_64BIT_PHYS_ADDR
-#define PGDIR_SHIFT	21
-#else
-#define PGDIR_SHIFT	22
-#endif
+#define PGDIR_SHIFT	(2 * PAGE_SHIFT + PTE_ORDER - PTE_T_LOG2)
 #define PGDIR_SIZE	(1UL << PGDIR_SHIFT)
 #define PGDIR_MASK	(~(PGDIR_SIZE-1))
 

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

* Re: [PATCH] 16K page size in 32 bit kernel
  2007-07-31 20:45     ` Ralf Baechle
@ 2007-08-01  0:47       ` Songmao Tian
  0 siblings, 0 replies; 7+ messages in thread
From: Songmao Tian @ 2007-08-01  0:47 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: Dajie Tan, linux-mips

Ralf Baechle wrote:
> On Tue, Jul 31, 2007 at 09:49:34PM +0800, Songmao Tian wrote:
>
>   
>> I think the following is more complete?
>>
>> #ifdef CONFIG_64BIT_PHYS_ADDR
>> -#define PGDIR_SHIFT    21
>> +#define PGDIR_SHIFT    (PAGE_SHIFT + (PAGE_SHIFT + PTE_ORDER - 3))
>> #else
>> -#define PGDIR_SHIFT    22
>> +#define PGDIR_SHIFT    (PAGE_SHIFT + (PAGE_SHIFT + PTE_ORDER - 2))
>> #endif
>>     
>
> Better suggestion :-)
>
>   Ralf
>
> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
>
> diff --git a/include/asm-mips/pgtable-32.h b/include/asm-mips/pgtable-32.h
> index 2fbd47e..ff29485 100644
> --- a/include/asm-mips/pgtable-32.h
> +++ b/include/asm-mips/pgtable-32.h
> @@ -43,11 +43,7 @@ extern int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1,
>   */
>  
>  /* PGDIR_SHIFT determines what a third-level page table entry can map */
> -#ifdef CONFIG_64BIT_PHYS_ADDR
> -#define PGDIR_SHIFT	21
> -#else
> -#define PGDIR_SHIFT	22
> -#endif
> +#define PGDIR_SHIFT	(2 * PAGE_SHIFT + PTE_ORDER - PTE_T_LOG2)
>  #define PGDIR_SIZE	(1UL << PGDIR_SHIFT)
>  #define PGDIR_MASK	(~(PGDIR_SIZE-1))
>  
>
>
>   

Sure:)

Tian

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

end of thread, other threads:[~2007-08-01  0:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-31 13:09 [PATCH] 16K page size in 32 bit kernel Dajie Tan
2007-07-31  9:37 ` Songmao Tian
2007-07-31  9:37   ` Songmao Tian
2007-07-31 10:00 ` Ralf Baechle
2007-07-31 13:49   ` Songmao Tian
2007-07-31 20:45     ` Ralf Baechle
2007-08-01  0:47       ` Songmao Tian

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