On Fri, 20 Oct 2000, Ben LaHaise wrote:
> 
> The primary reason I added the BUG was that if this is valid, it means
> that the pte has to be removed from the page tables first with
> pte_get_and_clear since it can be modified by the other CPU.  Although
> this may be safe for shm, I think it's very ugly and inconsistent.  I'd
> rather make the code transfer the dirty bit to the page struct so that we
> *know* there is no information loss.

Note that we should have done this regardless of the BUG() tests: remember
the PAE case, and the fact that it was illegal to do

        set_pte(page_table, swp_entry_to_pte(entry));

without having atomically cleared the pte first.

So regardless of any dirty/writable issues, that ptep_get_and_clear()
should be above the test for the PageSwapCache. Thanks for the patch.

Now, I agree 100% with you that we should _also_ make sure that we
transfer the dirty bit from the page tables to "struct page". Even if we
don't actually use that information right now. We _could_ use it: in
particular we could probably fairly easily speed up shared memory handling
by using the same kind of optimization that we do for private mappings -
using the dirty bit in the page table to determine whether we need to
write the page out again or not.

This all needs more thought, I suspect. But for now moving the
ptep_get_and_clear() up, and removing the BUG() is sufficient to get us
where we used to be.

                        Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/

Reply via email to