linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Linux Memory Management <linux-mm@kvack.org>
Cc: Andi Kleen <ak@suse.de>, Hugh Dickins <hugh@veritas.com>,
	Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>
Subject: [PATCH 5/10] alternate 4-level page tables patches
Date: Sat, 18 Dec 2004 17:58:01 +1100	[thread overview]
Message-ID: <41C3D4F9.9040803@yahoo.com.au> (raw)
In-Reply-To: <41C3D4C8.1000508@yahoo.com.au>

[-- Attachment #1: Type: text/plain, Size: 5 bytes --]

5/10

[-- Attachment #2: 4level-compat.patch --]
[-- Type: text/plain, Size: 6300 bytes --]



Generic headers to fold the 4-level pagetable into 3 levels.

Signed-off-by: Nick Piggin <nickpiggin@yahoo.com.au>


---

 linux-2.6-npiggin/include/asm-generic/pgtable-nopmd.h |   46 +++++++------
 linux-2.6-npiggin/include/asm-generic/pgtable-nopud.h |   61 ++++++++++++++++++
 linux-2.6-npiggin/include/asm-generic/tlb.h           |    6 +
 3 files changed, 91 insertions(+), 22 deletions(-)

diff -puN /dev/null include/asm-generic/pgtable-nopud.h
--- /dev/null	2004-09-06 19:38:39.000000000 +1000
+++ linux-2.6-npiggin/include/asm-generic/pgtable-nopud.h	2004-12-18 16:57:19.000000000 +1100
@@ -0,0 +1,61 @@
+#ifndef _PGTABLE_NOPUD_H
+#define _PGTABLE_NOPUD_H
+
+#ifndef __ASSEMBLY__
+
+/*
+ * Having the pud type consist of a pgd gets the size right, and allows
+ * us to conceptually access the pgd entry that this pud is folded into
+ * without casting.
+ */
+typedef struct { pgd_t pgd; } pud_t;
+
+#define PUD_SHIFT	PGDIR_SHIFT
+#define PTRS_PER_PUD	1
+#define PUD_SIZE  	(1UL << PUD_SHIFT)
+#define PUD_MASK  	(~(PUD_SIZE-1))
+
+/*
+ * The "pgd_xxx()" functions here are trivial for a folded two-level
+ * setup: the pud is never bad, and a pud always exists (as it's folded
+ * into the pgd entry)
+ */
+static inline int pgd_none(pgd_t pgd)		{ return 0; }
+static inline int pgd_bad(pgd_t pgd)		{ return 0; }
+static inline int pgd_present(pgd_t pgd)	{ return 1; }
+static inline void pgd_clear(pgd_t *pgd)	{ }
+#define pud_ERROR(pud)				(pgd_ERROR((pud).pgd))
+
+#define pgd_populate(mm, pgd, pud)		do { } while (0)
+/*
+ * (puds are folded into pgds so this doesn't get actually called,
+ * but the define is needed for a generic inline function.)
+ */
+#define set_pgd(pgdptr, pgdval)			set_pud((pud_t *)(pgdptr), (pud_t) { pgdval })
+
+static inline pud_t * pud_offset(pgd_t * pgd, unsigned long address)
+{
+	return (pud_t *)pgd;
+}
+
+static inline pud_t * pud_offset_k(pgd_t * pgd, unsigned long address)
+{
+	return (pud_t *)pgd;
+}
+
+#define pud_val(x)				(pgd_val((x).pgd))
+#define __pud(x)				((pud_t) { __pgd(x) } )
+
+#define pgd_page(pgd)				(pud_page((pud_t){ pgd }))
+#define pgd_page_kernel(pgd)			(pud_page_kernel((pud_t){ pgd }))
+
+/*
+ * allocating and freeing a pud is trivial: the 1-entry pud is
+ * inside the pgd, so has no extra memory associated with it.
+ */
+#define pud_alloc_one(mm, address)		NULL
+#define pud_free(x)				do { } while (0)
+#define __pud_free_tlb(tlb, x)			do { } while (0)
+
+#endif /* __ASSEMBLY__ */
+#endif /* _PGTABLE_NOPUD_H */
diff -puN include/asm-generic/pgtable-nopmd.h~4level-compat include/asm-generic/pgtable-nopmd.h
--- linux-2.6/include/asm-generic/pgtable-nopmd.h~4level-compat	2004-12-18 16:57:19.000000000 +1100
+++ linux-2.6-npiggin/include/asm-generic/pgtable-nopmd.h	2004-12-18 16:57:19.000000000 +1100
@@ -3,52 +3,54 @@
 
 #ifndef __ASSEMBLY__
 
+#include <asm-generic/pgtable-nopud.h>
+
 /*
- * Having the pmd type consist of a pgd gets the size right, and allows
- * us to conceptually access the pgd entry that this pmd is folded into
+ * Having the pmd type consist of a pud gets the size right, and allows
+ * us to conceptually access the pud entry that this pmd is folded into
  * without casting.
  */
-typedef struct { pgd_t pgd; } pmd_t;
+typedef struct { pud_t pud; } pmd_t;
 
-#define PMD_SHIFT	PGDIR_SHIFT
+#define PMD_SHIFT	PUD_SHIFT
 #define PTRS_PER_PMD	1
 #define PMD_SIZE  	(1UL << PMD_SHIFT)
 #define PMD_MASK  	(~(PMD_SIZE-1))
 
 /*
- * The "pgd_xxx()" functions here are trivial for a folded two-level
+ * The "pud_xxx()" functions here are trivial for a folded two-level
  * setup: the pmd is never bad, and a pmd always exists (as it's folded
- * into the pgd entry)
+ * into the pud entry)
  */
-static inline int pgd_none(pgd_t pgd)		{ return 0; }
-static inline int pgd_bad(pgd_t pgd)		{ return 0; }
-static inline int pgd_present(pgd_t pgd)	{ return 1; }
-static inline void pgd_clear(pgd_t *pgd)	{ }
-#define pmd_ERROR(pmd)				(pgd_ERROR((pmd).pgd))
+static inline int pud_none(pud_t pud)		{ return 0; }
+static inline int pud_bad(pud_t pud)		{ return 0; }
+static inline int pud_present(pud_t pud)	{ return 1; }
+static inline void pud_clear(pud_t *pud)	{ }
+#define pmd_ERROR(pmd)				(pud_ERROR((pmd).pud))
 
-#define pgd_populate(mm, pmd, pte)		do { } while (0)
-#define pgd_populate_kernel(mm, pmd, pte)	do { } while (0)
+#define pud_populate(mm, pmd, pte)		do { } while (0)
+#define pud_populate_kernel(mm, pmd, pte)	do { } while (0)
 
 /*
- * (pmds are folded into pgds so this doesn't get actually called,
+ * (pmds are folded into puds so this doesn't get actually called,
  * but the define is needed for a generic inline function.)
  */
-#define set_pgd(pgdptr, pgdval)			set_pmd((pmd_t *)(pgdptr), (pmd_t) { pgdval })
+#define set_pud(pudptr, pudval)			set_pmd((pmd_t *)(pudptr), (pmd_t) { pudval })
 
-static inline pmd_t * pmd_offset(pgd_t * pgd, unsigned long address)
+static inline pmd_t * pmd_offset(pud_t * pud, unsigned long address)
 {
-	return (pmd_t *)pgd;
+	return (pmd_t *)pud;
 }
 
-#define pmd_val(x)				(pgd_val((x).pgd))
-#define __pmd(x)				((pmd_t) { __pgd(x) } )
+#define pmd_val(x)				(pud_val((x).pud))
+#define __pmd(x)				((pmd_t) { __pud(x) } )
 
-#define pgd_page(pgd)				(pmd_page((pmd_t){ pgd }))
-#define pgd_page_kernel(pgd)			(pmd_page_kernel((pmd_t){ pgd }))
+#define pud_page(pud)				(pmd_page((pmd_t){ pud }))
+#define pud_page_kernel(pud)			(pmd_page_kernel((pmd_t){ pud }))
 
 /*
  * allocating and freeing a pmd is trivial: the 1-entry pmd is
- * inside the pgd, so has no extra memory associated with it.
+ * inside the pud, so has no extra memory associated with it.
  */
 #define pmd_alloc_one(mm, address)		NULL
 #define pmd_free(x)				do { } while (0)
diff -puN include/asm-generic/tlb.h~4level-compat include/asm-generic/tlb.h
--- linux-2.6/include/asm-generic/tlb.h~4level-compat	2004-12-18 16:57:19.000000000 +1100
+++ linux-2.6-npiggin/include/asm-generic/tlb.h	2004-12-18 16:57:19.000000000 +1100
@@ -141,6 +141,12 @@ static inline void tlb_remove_page(struc
 		__pte_free_tlb(tlb, ptep);			\
 	} while (0)
 
+#define pud_free_tlb(tlb, pudp)					\
+	do {							\
+		tlb->need_flush = 1;				\
+		__pud_free_tlb(tlb, pudp);			\
+	} while (0)
+
 #define pmd_free_tlb(tlb, pmdp)					\
 	do {							\
 		tlb->need_flush = 1;				\

_

  reply	other threads:[~2004-12-18  6:58 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-18  6:55 [RFC][PATCH 0/10] " Nick Piggin
2004-12-18  6:55 ` [PATCH 1/10] " Nick Piggin
2004-12-18  6:56   ` [PATCH 2/10] " Nick Piggin
2004-12-18  6:56     ` [PATCH 3/10] " Nick Piggin
2004-12-18  6:57       ` [PATCH 4/10] " Nick Piggin
2004-12-18  6:58         ` Nick Piggin [this message]
2004-12-18  6:58           ` [PATCH 6/10] " Nick Piggin
2004-12-18  6:59             ` [PATCH 7/10] " Nick Piggin
2004-12-18  7:00               ` [PATCH 8/10] " Nick Piggin
2004-12-18  7:00                 ` [PATCH 9/10] " Nick Piggin
2004-12-18  7:01                   ` [PATCH 10/10] " Nick Piggin
2004-12-18  7:31                     ` Andi Kleen
2004-12-18  7:46                       ` Nick Piggin
2004-12-18  8:08                       ` Andrew Morton
2004-12-18  9:48                         ` Andi Kleen
2004-12-18 19:06                       ` Linus Torvalds
2004-12-20 17:43                         ` Andi Kleen
2004-12-20 17:47                           ` Randy.Dunlap
2004-12-20 18:08                           ` Linus Torvalds
2004-12-20 18:15                             ` Linus Torvalds
2004-12-20 18:19                             ` Andi Kleen
2004-12-20 18:47                               ` Linus Torvalds
2004-12-20 18:52                                 ` Linus Torvalds
2004-12-20 18:59                                 ` Andi Kleen
2004-12-20 18:57                                   ` Randy.Dunlap
2004-12-18  9:05         ` [PATCH 4/10] " Nick Piggin
2004-12-18  9:50           ` Andi Kleen
2004-12-18 10:06             ` Nick Piggin
2004-12-18 10:11               ` Andi Kleen
2004-12-18 10:22               ` Nick Piggin
2004-12-18 10:29                 ` Nick Piggin
2004-12-18 11:06               ` William Lee Irwin III
2004-12-18 11:17                 ` Nick Piggin
2004-12-18 11:32                   ` William Lee Irwin III
2004-12-18 11:55                     ` Nick Piggin
2004-12-18 12:46                       ` William Lee Irwin III
2004-12-18 12:48                         ` William Lee Irwin III
2004-12-19  0:05                         ` Nick Piggin
2004-12-19  0:20                           ` William Lee Irwin III
2004-12-19  0:38                             ` Nick Piggin
2004-12-19  1:01                               ` William Lee Irwin III
2004-12-19  1:31                             ` Linus Torvalds
2004-12-19  2:08                               ` William Lee Irwin III
2004-12-19  2:26                                 ` Nick Piggin
2004-12-19  5:23                                 ` Linus Torvalds
2004-12-19  6:02                                   ` William Lee Irwin III
2004-12-19 18:17                                     ` Linus Torvalds
2004-12-20  1:00                                       ` William Lee Irwin III
2004-12-18 10:45         ` William Lee Irwin III
2004-12-18 10:58           ` Nick Piggin
2004-12-19  0:07 ` [RFC][PATCH 0/10] " Hugh Dickins
2004-12-19  0:33   ` Nick Piggin
2004-12-20 18:04   ` Andi Kleen
2004-12-20 18:40     ` Linus Torvalds
2004-12-20 18:53       ` Andi Kleen
2004-12-21  0:04         ` Linus Torvalds
2004-12-21  0:22           ` Andi Kleen
2004-12-21  0:43             ` Linus Torvalds
2004-12-21  0:47             ` Nick Piggin
2004-12-21  2:55               ` Hugh Dickins
2004-12-21  3:21                 ` Nick Piggin
2004-12-21  3:47                 ` Linus Torvalds
2004-12-21  3:56                   ` Linus Torvalds
2004-12-21  4:04                     ` Nick Piggin
2004-12-21  4:08                       ` Nick Piggin
2004-12-21  9:36                     ` Andi Kleen
2004-12-21 10:13                       ` Hugh Dickins
2004-12-21 10:59                       ` Nick Piggin
2004-12-21 17:36                       ` Linus Torvalds
2004-12-21 20:19                         ` Andi Kleen
2004-12-21 23:49                           ` Nick Piggin
2004-12-22 10:38                             ` Andi Kleen
2004-12-22 11:19                               ` Nick Piggin
2004-12-22 11:23                                 ` Nick Piggin
2004-12-22 18:07                                 ` Andi Kleen
2004-12-30 21:24                                   ` Nick Piggin
2004-12-21 10:52                     ` Nick Piggin

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=41C3D4F9.9040803@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=hugh@veritas.com \
    --cc=linux-mm@kvack.org \
    --cc=torvalds@osdl.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox