Re: pre12 VM doubts and patch

Andrea Arcangeli (andrea@suse.de)
Thu, 20 Sep 2001 08:26:02 +0200


On Thu, Sep 20, 2001 at 08:08:37AM +0200, Andrea Arcangeli wrote:
> --- 2.4.10pre12aa1/mm/memory.c.~1~ Thu Sep 20 07:20:03 2001
> +++ 2.4.10pre12aa1/mm/memory.c Thu Sep 20 08:06:29 2001
> @@ -1155,15 +1155,8 @@
> pte = mk_pte(page, vma->vm_page_prot);
>
> swap_free(entry);
> - if (exclusive_swap_page(page)) {
> -#if 0
> - if (write_access)
> - pte = pte_mkwrite(pte_mkdirty(pte));
> -#else
> + if (exclusive_swap_page(page))
> delete_from_swap_cache_nolock(page);
> - pte = pte_mkwrite(pte_mkdirty(pte));
> -#endif
> - }

forget that, of course if write_access is set it means we can write to
the page or the page fault would be finished much earlier. This looks
much better:

--- 2.4.10pre12aa1/mm/memory.c.~1~ Thu Sep 20 07:20:03 2001
+++ 2.4.10pre12aa1/mm/memory.c Thu Sep 20 08:24:03 2001
@@ -1156,13 +1156,11 @@

swap_free(entry);
if (exclusive_swap_page(page)) {
-#if 0
if (write_access)
pte = pte_mkwrite(pte_mkdirty(pte));
-#else
+ else if (vma->vm_flags & VM_WRITE)
+ pte = pte_mkwrite(pte);
delete_from_swap_cache_nolock(page);
- pte = pte_mkwrite(pte_mkdirty(pte));
-#endif
}
UnlockPage(page);

(we'll avoid the page fault this way in the "read" swapin too, by
checking if we're allowed to write to it or not, looks worthwhile check,
however it matters only for the archs where the dirty bit is set in
hardware)

Andrea
-
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/