lkml.org 
[lkml]   [1998]   [Jul]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 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

\
 
 \ /
  Last update: 2005-03-22 13:43    [W:0.023 / U:0.272 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site