From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Hugh Dickins <hugh@veritas.com>, Andi Kleen <ak@suse.de>,
Linux Memory Management <linux-mm@kvack.org>,
Andrew Morton <akpm@osdl.org>
Subject: Re: [RFC][PATCH 0/10] alternate 4-level page tables patches
Date: Tue, 21 Dec 2004 21:52:54 +1100 [thread overview]
Message-ID: <41C80086.7080904@yahoo.com.au> (raw)
In-Reply-To: <Pine.LNX.4.58.0412201953040.4112@ppc970.osdl.org>
[-- Attachment #1: Type: text/plain, Size: 768 bytes --]
Linus Torvalds wrote:
> Nick, can you see if such a patch is possible? I'll test ppc64 still
> working..
>
OK I seem to have got something working after fumbling around in the
dark for a bit. I apologise if it blows up straight away for you, which
isn't unlikely.
Tested only on i386 2-levels for now (not much point in testing i386
3 levels really). I'll do some testing on ia64 and x86-64 tomorrow, but
I've run out of time tonight.
You'll want the full rollup here (against 2.6.10-rc3):
http://www.kerneltrap.org/~npiggin/vm/4level.patch.gz
And attached is the broken out patch (included in the above). An arch
only needs to include this in asm/pgtable.h, and no other changes. As
you see it wasn't _quite_ as clean as Hugh had hoped, but not too bad.
Nick
[-- Attachment #2: 4level-fallback.patch --]
[-- Type: text/plain, Size: 3259 bytes --]
---
linux-2.6-npiggin/include/asm-generic/4level-fixup.h | 32 +++++++++++++++++++
linux-2.6-npiggin/include/linux/mm.h | 6 +++
linux-2.6-npiggin/mm/memory.c | 25 ++++++++++++++
3 files changed, 63 insertions(+)
diff -puN /dev/null include/asm-generic/4level-fixup.h
--- /dev/null 2004-09-06 19:38:39.000000000 +1000
+++ linux-2.6-npiggin/include/asm-generic/4level-fixup.h 2004-12-21 20:27:48.000000000 +1100
@@ -0,0 +1,32 @@
+#ifndef _4LEVEL_FIXUP_H
+#define _4LEVEL_FIXUP_H
+
+#define __ARCH_HAS_4LEVEL_HACK
+
+#define PUD_SIZE PGDIR_SIZE
+#define PUD_MASK PGDIR_MASK
+#define PTRS_PER_PUD 1
+
+#define pud_t pgd_t
+
+#define pmd_alloc(mm, pud, address) \
+({ pmd_t *ret; \
+ if (pgd_none(*pud)) \
+ ret = __pmd_alloc(mm, pud, address); \
+ else \
+ ret = pmd_offset(pud, address); \
+ ret; \
+})
+
+#define pud_alloc(mm, pgd, address) (pgd)
+#define pud_offset(pgd, start) (pgd)
+#define pud_none(pud) 0
+#define pud_bad(pud) 0
+#define pud_present(pud) 1
+#define pud_ERROR(pud) do { printk("pud_ERROR\n"); BUG(); } while (0)
+#define pud_clear(pud) do { } while (0)
+
+#define pud_free(x) do { } while (0)
+#define __pud_free_tlb(tlb, x) do { } while (0)
+
+#endif
diff -puN include/linux/mm.h~4level-fallback include/linux/mm.h
--- linux-2.6/include/linux/mm.h~4level-fallback 2004-12-21 20:27:48.000000000 +1100
+++ linux-2.6-npiggin/include/linux/mm.h 2004-12-21 20:27:48.000000000 +1100
@@ -631,6 +631,11 @@ extern void remove_shrinker(struct shrin
* the inlining and the symmetry break with pte_alloc_map() that does all
* of this out-of-line.
*/
+/*
+ * The following ifdef needed to get the 4level-fixup.h header to work.
+ * Remove it when 4level-fixup.h has been removed.
+ */
+#ifndef __ARCH_HAS_4LEVEL_HACK
static inline pud_t *pud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long address)
{
if (pgd_none(*pgd))
@@ -644,6 +649,7 @@ static inline pmd_t *pmd_alloc(struct mm
return __pmd_alloc(mm, pud, address);
return pmd_offset(pud, address);
}
+#endif
extern void free_area_init(unsigned long * zones_size);
extern void free_area_init_node(int nid, pg_data_t *pgdat,
diff -puN mm/memory.c~4level-fallback mm/memory.c
--- linux-2.6/mm/memory.c~4level-fallback 2004-12-21 20:27:48.000000000 +1100
+++ linux-2.6-npiggin/mm/memory.c 2004-12-21 20:27:48.000000000 +1100
@@ -1940,6 +1940,7 @@ int handle_mm_fault(struct mm_struct *mm
return VM_FAULT_OOM;
}
+#ifndef __ARCH_HAS_4LEVEL_HACK
#if (PTRS_PER_PGD > 1)
/*
* Allocate page upper directory.
@@ -2007,6 +2008,30 @@ out:
return pmd_offset(pud, address);
}
#endif
+#else
+pmd_t fastcall *__pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address)
+{
+ pmd_t *new;
+
+ spin_unlock(&mm->page_table_lock);
+ new = pmd_alloc_one(mm, address);
+ spin_lock(&mm->page_table_lock);
+ if (!new)
+ return NULL;
+
+ /*
+ * Because we dropped the lock, we should re-check the
+ * entry, as somebody else could have populated it..
+ */
+ if (pgd_present(*pud)) {
+ pmd_free(new);
+ goto out;
+ }
+ pgd_populate(mm, pud, new);
+out:
+ return pmd_offset(pud, address);
+}
+#endif
int make_pages_present(unsigned long addr, unsigned long end)
{
_
prev parent reply other threads:[~2004-12-21 10:52 UTC|newest]
Thread overview: 77+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-18 6:55 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 ` [PATCH 5/10] " Nick Piggin
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 [this message]
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=41C80086.7080904@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