linux-mips
[Top] [All Lists]

[RFC] Calculate exactly how many ptr is needed for pgd

To: linux-mips <linux-mips@linux-mips.org>, Ralf Baechle <ralf@linux-mips.org>
Subject: [RFC] Calculate exactly how many ptr is needed for pgd
From: Songmao Tian <tiansm@lemote.com>
Date: Tue, 31 Jul 2007 22:38:57 +0800
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
User-agent: Icedove 1.5.0.8 (X11/20061116)
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)

<Prev in Thread] Current Thread [Next in Thread>
  • [RFC] Calculate exactly how many ptr is needed for pgd, Songmao Tian <=