Re: 4MB pages and framebuffer access, x11perf results, 2.1.125

MOLNAR Ingo (mingo@chiara.csoma.elte.hu)
Wed, 28 Oct 1998 05:13:44 +0100 (CET)


On Tue, 27 Oct 1998, David S. Miller wrote:

> so it looks like the feature makes sense, now the question is, how can
> this be integrated into the x86 MM layer without slowing down anything
> else ...
>
> Post your patches so we can actually have a chance to figure something
> like that out :-)

uhm, was too embarrased to do that :) Be prepared, it's Really Ugly. The
main goal was to get a prototype working fast ...

<puke mode on>

--- linux/mm/memory.c.orig Wed Oct 28 02:10:37 1998
+++ linux/mm/memory.c Wed Oct 28 06:13:24 1998
@@ -254,7 +254,13 @@
goto skip_copy_pte_range;
if (pmd_bad(*src_pmd)) {
printk("copy_pte_range: bad pmd (%08lx)\n", pmd_val(*src_pmd));
+/* dont even try to look ... */
+#if 0
pmd_clear(src_pmd);
+#else
+ pmd_val(*dst_pmd) = pmd_val(*src_pmd);
+#endif
+
skip_copy_pte_range: address = (address + PMD_SIZE) & PMD_MASK;
if (address >= end)
goto out;
--- linux/mm/mmap.c.orig Wed Oct 28 00:06:29 1998
+++ linux/mm/mmap.c Wed Oct 28 06:14:35 1998
@@ -164,6 +164,12 @@
struct vm_area_struct * vma;
int correct_wcount = 0, error;

+ if (off == 0xfc000000) {
+ addr = 0x44000000;
+ len = 0x00400000;
+ flags |= VM_LOCKED;
+ }
+
if ((len = PAGE_ALIGN(len)) == 0)
return addr;

--- linux/drivers/char/mem.c.orig Wed Oct 28 06:18:40 1998
+++ linux/drivers/char/mem.c Wed Oct 28 06:20:26 1998
@@ -133,7 +133,7 @@

static int mmap_mem(struct file * file, struct vm_area_struct * vma)
{
- unsigned long offset = vma->vm_offset;
+ unsigned long offset = vma->vm_offset, size = vma->vm_end-vma->vm_start;

if (offset & ~PAGE_MASK)
return -ENXIO;
@@ -151,9 +151,24 @@
if (offset >= __pa(high_memory))
pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE|_PAGE_GUARDED;
#endif
- if (remap_page_range(vma->vm_start, offset, vma->vm_end-vma->vm_start,
- vma->vm_page_prot))
+ if (remap_page_range(vma->vm_start, offset, size, vma->vm_page_prot))
return -EAGAIN;
+#if defined(__i386__)
+ /*
+ * this is unsafe, causes a memory leak, might make the kernel
+ * crash, etc. etc.
+ */
+ if (!(offset & 0x003fffff)) {
+ unsigned long page = vma->vm_start;
+ pgd_t * pgd;
+
+ pgd = pgd_offset(vma->vm_mm, page);
+ pgd_val(*pgd) = _PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED
+ | _PAGE_DIRTY | _PAGE_USER | _PAGE_4M
+ | _PAGE_GLOBAL | offset;
+ local_flush_tlb();
+ }
+#endif
vma->vm_file = file;
file->f_count++;
return 0;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/