From: Songmao Tian <tiansm@lemote.com>
To: linux-mips <linux-mips@linux-mips.org>
Subject: [PATCH] Calculate exactly how many pointers in PGD
Date: Tue, 18 Sep 2007 21:33:25 +0800 [thread overview]
Message-ID: <46EFD3A5.8080102@lemote.com> (raw)
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)
reply other threads:[~2007-09-18 13:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46EFD3A5.8080102@lemote.com \
--to=tiansm@lemote.com \
--cc=linux-mips@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.