Re: improved memory defragger

Rik van Riel (H.H.vanRiel@phys.uu.nl)
Fri, 24 Jul 1998 10:39:42 +0200 (CEST)


On Thu, 23 Jul 1998, David S. Miller wrote:
> Date: Thu, 23 Jul 1998 18:36:39 -0400
> From: Bill Hawes <whawes@star.net>
>
> 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);
>
> I think this is OK, but if I've overlooked any cache-flushing, pte-bit,
> or other considerations, hopefully someone will spot it.
>
> You need to add this after the copy_page():
>
> flush_page_to_ram(old_page);
> flush_page_to_ram(new_page);

And maybe it's an idea to prevent the program from using
that piece of memory while the defragging is going on...
It might make for some 'interesting' bugs :)

Rik.
+-------------------------------------------------------------------+
| Linux memory management tour guide. H.H.vanRiel@phys.uu.nl |
| Scouting Vries cubscout leader. http://www.phys.uu.nl/~riel/ |
+-------------------------------------------------------------------+

-
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