Messages in this thread Patch in this message | | | From | Akinobu Mita <> | Subject | Re: Anticipatory prefaulting in the page fault handler V1 | Date | Mon, 13 Dec 2004 23:30:23 +0900 |
| |
On Friday 10 December 2004 04:32, Christoph Lameter wrote: > On Wed, 8 Dec 2004, Martin J. Bligh wrote: > > I tried benchmarking it ... but processes just segfault all the time. > > Any chance you could try it out on SMP ia32 system? > > I tried it on my i386 system and it works fine. Sorry about the puny > memory sizes (the system is a PIII-450 with 384k memory) >
I also encountered processes segfault. Below patch fix several problems.
1) if no pages could allocated, returns VM_FAULT_OOM 2) fix duplicated pte_offset_map() call 3) don't set_pte() for the entry which already have been set
Acutually, 3) fixes my segfault problem.
--- 2.6-rc/mm/memory.c.orig 2004-12-13 22:17:04.000000000 +0900 +++ 2.6-rc/mm/memory.c 2004-12-13 22:22:14.000000000 +0900 @@ -1483,6 +1483,8 @@ do_anonymous_page(struct mm_struct *mm, } else break; } + if (a == addr) + goto no_mem; end_addr = a; spin_lock(&mm->page_table_lock); @@ -1514,8 +1516,17 @@ do_anonymous_page(struct mm_struct *mm, } } else { /* Read */ + int first = 1; + for(;addr < end_addr; addr += PAGE_SIZE) { - page_table = pte_offset_map(pmd, addr); + if (!first) + page_table = pte_offset_map(pmd, addr); + first = 0; + if (!pte_none(*page_table)) { + /* Someone else got there first */ + pte_unmap(page_table); + continue; + } entry = pte_wrprotect(mk_pte(ZERO_PAGE(addr), vma->vm_page_prot)); set_pte(page_table, entry); pte_unmap(page_table);
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |