Messages in this thread | | | Date | Fri, 24 Jul 1998 13:54:13 -0400 | From | Bill Hawes <> | Subject | Re: improved memory defragger |
| |
David Miller and Roger Wolff pointed out a couple of problems with my page replacement code, and I've revised it as below. Some architectures need additional cache flushing, and it needed protection against another CPU writing to the page while trying to copy it. The latter case has been handled by unmapping the page before doing the copy:
/* Create the new pte value */ new_pte = mk_pte(new_page, vma->vm_page_prot); if (pte_write(pte)) new_pte = pte_mkwrite(new_pte); if (pte_dirty(pte)) new_pte = pte_mkdirty(new_pte); /* * Unmap the page before doing the copy, * in case another CPU is writing to it. */ flush_cache_page(vma, addr); pte_clear(dir); flush_tlb_page(vma, addr);
/* copy the data */ copy_page(new_page, old_page); flush_page_to_ram(new_page); flush_page_to_ram(old_page);
/* install the new pte */ set_pte(dir, new_pte);
The page replacement is now like a back-to-back swapout/swapin with a copy to a different page, so it should be conceptually sound.
If nobody spots any other problems, I'll post the defragger patch later this afternoon. The defragger is now much better at building 16K and 32K pages, and I hope it will be a useful addition to the vm arsenal.
Regards, Bill
- 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.altern.org/andrebalsa/doc/lkml-faq.html
| |