Re: architecture bootup changes..

Paul Mackerras (paulus@linuxcare.com)
Thu, 21 Oct 1999 14:25:51 +1000


On Thu, 21 Oct 1999, Linus Torvalds wrote:

> Ho humm.. I would almost prefer the "struct page" because in theory you
> might want to do it without mapping the page at all. But this is
> definitely a case where most of the time it's only needed with virtual
> caches, so at the same time a virtual address is not necessarily wrong
> either.
>
> So my preference would be a "struct page", but if you have a stronger
> opinion you can override me with a little argumentation for show, ok?

I don't have a strong opinion about it, I'm quite happy with the struct
page option. Here is a patch which fixes the places where pre-2.3.23-5
calls flush_page_to_ram with a virtual address (in the generic code; I
haven't tried to fix the places under arch/), plus a thinko in
mm/memory.c.

I have pre-2.3.23-5 running on my PPC (an Apple G3 powerbook) but it
crashes as soon as it starts to use swap, with a kernel bug at
include/linux/pagemap.h:105, in kswapd. The stack trace is:

add_page_to_inode_queue (inline in add_to_page_cache)
add_to_page_cache
add_to_swap_cache
try_to_swap_out
swap_out_vma
swap_out_mm
swap_out
do_try_to_free_pages
kswapd

Have others seen this problem, or is it a PPC-specific stuff-up of mine?
:-)

Paul.

diff -urN official/fs/exec.c linux/fs/exec.c
--- official/fs/exec.c Thu Oct 21 11:57:36 1999
+++ linux/fs/exec.c Thu Oct 21 13:46:02 1999
@@ -246,7 +246,7 @@
memset(kaddr+offset+len, 0, PAGE_SIZE-offset-len);
}
err = copy_from_user(kaddr + offset, str, bytes_to_copy);
- flush_page_to_ram(kaddr);
+ flush_page_to_ram(page);
kunmap((unsigned long)kaddr, KM_WRITE);

if (err)
diff -urN official/include/linux/highmem.h linux/include/linux/highmem.h
--- official/include/linux/highmem.h Thu Oct 21 11:57:38 1999
+++ linux/include/linux/highmem.h Thu Oct 21 14:01:23 1999
@@ -59,7 +59,7 @@
BUG();
kaddr = kmap(page, KM_WRITE);
memset((void *)(kaddr + offset), 0, size);
- flush_page_to_ram(kaddr);
+ flush_page_to_ram(page);
kunmap(kaddr, KM_WRITE);
}

diff -urN official/kernel/ptrace.c linux/kernel/ptrace.c
--- official/kernel/ptrace.c Thu Oct 21 11:57:38 1999
+++ linux/kernel/ptrace.c Thu Oct 21 14:01:22 1999
@@ -52,12 +52,12 @@
if (write) {
maddr = kmap(page, KM_WRITE);
memcpy((char *)maddr + (addr & ~PAGE_MASK), buf, len);
- flush_page_to_ram(maddr);
+ flush_page_to_ram(page);
kunmap(maddr, KM_WRITE);
} else {
maddr = kmap(page, KM_READ);
memcpy(buf, (char *)maddr + (addr & ~PAGE_MASK), len);
- flush_page_to_ram(maddr);
+ flush_page_to_ram(page);
kunmap(maddr, KM_READ);
}
return len;
diff -urN official/mm/memory.c linux/mm/memory.c
--- official/mm/memory.c Thu Oct 21 11:57:38 1999
+++ linux/mm/memory.c Thu Oct 21 14:01:21 1999
@@ -742,7 +742,7 @@
__free_page(page);
return 0;
}
- flush_page_to_ram(pte_page(page));
+ flush_page_to_ram(page);
set_pte(pte, pte_mkwrite(page_pte_prot(page, PAGE_COPY)));
/* no need for flush_tlb */
return page;

-
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/