Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [RFC] Calculate exactly how many ptr is needed for pgd
@ 2007-07-31 14:38 Songmao Tian
       [not found] ` <5861a7880708012054u404c9b02s7141d1811d4a7fdf@mail.gmail.com>
  0 siblings, 1 reply; 2+ messages in thread
From: Songmao Tian @ 2007-07-31 14:38 UTC (permalink / raw)
  To: linux-mips, Ralf Baechle

Under 32-bit kernel with 4k page, a page is needed for a pgd,
but when page size > 4k, a page will be too much.

diff --git a/include/asm-mips/pgtable-32.h b/include/asm-mips/pgtable-32.h
index 2fbd47e..2a16240 100644
--- a/include/asm-mips/pgtable-32.h
+++ b/include/asm-mips/pgtable-32.h
@@ -67,7 +67,8 @@ extern int add_temporary_entry(unsigned long entrylo0, 
unsigned long entrylo1,
 #define PTE_ORDER    0
 #endif
 
-#define PTRS_PER_PGD    ((PAGE_SIZE << PGD_ORDER) / sizeof(pgd_t))
+/* Using a page for pgd will be a waste when page size > 4k */
+#define PTRS_PER_PGD    (1 << (32 - PGDIR_SHIFT))
 #define PTRS_PER_PTE    ((PAGE_SIZE << PTE_ORDER) / sizeof(pte_t))
 
 #define USER_PTRS_PER_PGD    (0x80000000UL/PGDIR_SIZE)

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

* Fwd: [RFC] Calculate exactly how many ptr is needed for pgd
       [not found] ` <5861a7880708012054u404c9b02s7141d1811d4a7fdf@mail.gmail.com>
@ 2007-08-02  3:55   ` Dajie Tan
  0 siblings, 0 replies; 2+ messages in thread
From: Dajie Tan @ 2007-08-02  3:55 UTC (permalink / raw)
  To: linux-mips, Ralf

It works well. If I start xorg+xfce, it can save 2.5MB memory in my system.

Thanks, songmao.

2007/7/31, Songmao Tian <tiansm@lemote.com>:
> Under 32-bit kernel with 4k page, a page is needed for a pgd,
> but when page size > 4k, a page will be too much.
>
> diff --git a/include/asm-mips/pgtable-32.h b/include/asm-mips/pgtable-32.h
> index 2fbd47e..2a16240 100644
> --- a/include/asm-mips/pgtable-32.h
> +++ b/include/asm-mips/pgtable-32.h
> @@ -67,7 +67,8 @@ extern int add_temporary_entry(unsigned long entrylo0,
> unsigned long entrylo1,
>  #define PTE_ORDER    0
>  #endif
>
> -#define PTRS_PER_PGD    ((PAGE_SIZE << PGD_ORDER) / sizeof(pgd_t))
> +/* Using a page for pgd will be a waste when page size > 4k */
> +#define PTRS_PER_PGD    (1 << (32 - PGDIR_SHIFT))
>  #define PTRS_PER_PTE    ((PAGE_SIZE << PTE_ORDER) / sizeof(pte_t))
>
>  #define USER_PTRS_PER_PGD    (0x80000000UL/PGDIR_SIZE)
>
>


-- 
为天地立心
为生民立命
为往圣继绝学
为万世开太平

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

end of thread, other threads:[~2007-08-02  3:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-31 14:38 [RFC] Calculate exactly how many ptr is needed for pgd Songmao Tian
     [not found] ` <5861a7880708012054u404c9b02s7141d1811d4a7fdf@mail.gmail.com>
2007-08-02  3:55   ` Fwd: " Dajie Tan

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