linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Andrew Morton <akpm@osdl.org>, Andi Kleen <ak@suse.de>,
	Hugh Dickins <hugh@veritas.com>,
	Linux Memory Management <linux-mm@kvack.org>
Subject: [PATCH 2/11] generic 3-level nopmd folding header
Date: Wed, 22 Dec 2004 20:53:43 +1100	[thread overview]
Message-ID: <41C94427.9020601@yahoo.com.au> (raw)
In-Reply-To: <41C943F0.4090006@yahoo.com.au>

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

2/11

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



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

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


---

 linux-2.6-npiggin/include/asm-generic/pgtable-nopmd.h |   59 ++++++++++++++++++
 1 files changed, 59 insertions(+)

diff -puN /dev/null include/asm-generic/pgtable-nopmd.h
--- /dev/null	2004-09-06 19:38:39.000000000 +1000
+++ linux-2.6-npiggin/include/asm-generic/pgtable-nopmd.h	2004-12-22 20:35:57.000000000 +1100
@@ -0,0 +1,59 @@
+#ifndef _PGTABLE_NOPMD_H
+#define _PGTABLE_NOPMD_H
+
+#ifndef __ASSEMBLY__
+
+/*
+ * 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
+ * without casting.
+ */
+typedef struct { pgd_t pgd; } pmd_t;
+
+#define PMD_SHIFT	PGDIR_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
+ * setup: the pmd is never bad, and a pmd 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 pmd_ERROR(pmd)				(pgd_ERROR((pmd).pgd))
+
+#define pgd_populate(mm, pmd, pte)		do { } while (0)
+#define pgd_populate_kernel(mm, pmd, pte)	do { } while (0)
+
+/*
+ * (pmds 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_pmd((pmd_t *)(pgdptr), (pmd_t) { pgdval })
+
+static inline pmd_t * pmd_offset(pgd_t * pgd, unsigned long address)
+{
+	return (pmd_t *)pgd;
+}
+
+#define pmd_val(x)				(pgd_val((x).pgd))
+#define __pmd(x)				((pmd_t) { __pgd(x) } )
+
+#define pgd_page(pgd)				(pmd_page((pmd_t){ pgd }))
+#define pgd_page_kernel(pgd)			(pmd_page_kernel((pmd_t){ pgd }))
+
+/*
+ * allocating and freeing a pmd is trivial: the 1-entry pmd is
+ * inside the pgd, so has no extra memory associated with it.
+ */
+#define pmd_alloc_one(mm, address)		NULL
+#define pmd_free(x)				do { } while (0)
+#define __pmd_free_tlb(tlb, x)			do { } while (0)
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* _PGTABLE_NOPMD_H */

_

  reply	other threads:[~2004-12-22  9:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-22  9:50 [PATCH 0/11] alternate 4-level page tables patches (take 2) Nick Piggin
2004-12-22  9:52 ` [PATCH 1/11] parentheses to x86-64 macro Nick Piggin
2004-12-22  9:53   ` Nick Piggin [this message]
2004-12-22  9:54     ` [PATCH 3/11] convert i386 to generic nopmd header Nick Piggin
2004-12-22  9:54       ` [PATCH 4/11] split copy_page_range Nick Piggin
2004-12-22  9:55         ` [PATCH 5/11] replace clear_page_tables with clear_page_range Nick Piggin
2004-12-22  9:56           ` [PATCH 6/11] introduce 4-level nopud folding header Nick Piggin
2004-12-22  9:57             ` [PATCH 7/11] convert Linux to 4-level page tables Nick Piggin
2004-12-22  9:59               ` [PATCH 8/11] introduce fallback header Nick Piggin
2004-12-22 10:00                 ` [PATCH 9/11] convert i386 to generic nopud header Nick Piggin
2004-12-22 10:00                   ` [PATCH 10/11] convert ia64 " Nick Piggin
2004-12-22 10:01                     ` [PATCH 11/11] convert x86_64 to 4 level page tables Nick Piggin
2004-12-22 10:18 ` [PATCH 0/11] alternate 4-level page tables patches (take 2) Andi Kleen

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=41C94427.9020601@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