improved memory defragger

Bill Hawes (whawes@star.net)
Thu, 23 Jul 1998 18:36:39 -0400


I've added code to allow the defragger to replace pages mapped by
processes in addition to freeing page and buffer cache pages. This
appears to make it much more effective than with just freeing cache
pages alone.

The crux of the page replacement is in this bit of code, with new_page
being freshly allocated and old_page with count == 1:

/* 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);
printk("do_defrag: changing pte, old=%08x, new=%08x\n", pte, new_pte);
/* copy the data */
copy_page(new_page, old_page);
flush_cache_page(vma, addr);
/* install the new pte */
set_pte(dir, new_pte);
flush_tlb_page(vma, addr);

I think this is OK, but if I've overlooked any cache-flushing, pte-bit,
or other considerations, hopefully someone will spot it.

I'll post an updated patch later today or tomorrow after further
testing.

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