diff -ur v2.4.0-test11-pre1/mm/memory.c test10/mm/memory.c --- v2.4.0-test11-pre1/mm/memory.c Tue Nov 7 17:12:43 2000 +++ test10/mm/memory.c Tue Nov 7 17:06:20 2000 @@ -858,6 +858,7 @@ /* * Ok, we need to copy. Oh, well.. */ + set_pte(page_table, pte); spin_unlock(&mm->page_table_lock); new_page = page_cache_alloc(); if (!new_page) @@ -868,6 +869,11 @@ * Re-check the pte - we dropped the lock */ if (pte_same(*page_table, pte)) { + /* We are changing the pte, so get rid of the old + * one to avoid races with the hardware, this really + * only affects the accessed bit here. + */ + pte = ptep_get_and_clear(page_table); if (PageReserved(old_page)) ++mm->rss; break_cow(vma, old_page, new_page, address, page_table); @@ -1219,12 +1225,14 @@ return do_swap_page(mm, vma, address, pte, pte_to_swp_entry(entry), write_access); } + entry = ptep_get_and_clear(pte); if (write_access) { if (!pte_write(entry)) return do_wp_page(mm, vma, address, pte, entry); entry = pte_mkdirty(entry); } + entry = pte_mkyoung(entry); establish_pte(vma, address, pte, entry); spin_unlock(&mm->page_table_lock);