All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Calculate exactly how many pointers in PGD
@ 2007-09-18 13:33 Songmao Tian
  0 siblings, 0 replies; only message in thread
From: Songmao Tian @ 2007-09-18 13:33 UTC (permalink / raw)
  To: linux-mips

In 32-bit kernel, we treat BadAddr as a 32-bit address,
so using a page for pgd will be a waste when page size > 4k,
calculating exactly how many pointers in PGD will save memory
quite a bit.

Signed-off-by: Songmao Tian <tiansm@lemote.com>
---
 include/asm-mips/pgtable-32.h |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/include/asm-mips/pgtable-32.h b/include/asm-mips/pgtable-32.h
index 59c865d..dc8ec21 100644
--- a/include/asm-mips/pgtable-32.h
+++ b/include/asm-mips/pgtable-32.h
@@ -57,7 +57,12 @@ extern int add_temporary_entry(unsigned long 
entrylo0, unsigned long entrylo1,
 #define PMD_ORDER    1
 #define PTE_ORDER    0
 
-#define PTRS_PER_PGD    ((PAGE_SIZE << PGD_ORDER) / sizeof(pgd_t))
+/*
+ * Using a page for pgd will be a waste when page size > 4k,
+ * so we calculate exactly how many pointers in PGD under
+ * 32-bit address space configuration.
+ */
+#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] only message in thread

only message in thread, other threads:[~2007-09-18 13:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-18 13:33 [PATCH] Calculate exactly how many pointers in PGD Songmao Tian

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.