Re: [PATCH] Optimize page_remove_rmap for anon pages

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <schwidefsky@...>
Cc: <linux-mm@...>, <linux-kernel@...>, <linux-s390@...>
Date: Monday, June 2, 2008 - 7:57 pm

On Thursday 29 May 2008 23:56, Martin Schwidefsky wrote:

I don't know if it is that simple, is it?

I don't know how you are guaranteeing the given page ceases to exist.
Even checking for the last mapper of the page (which you don't appear
to do anyway) isn't enough because there could be a swapcount, in which
case you should still have to mark the page as dirty.

For example (I think, unless s390 somehow propogates the dirty page
bit some other way that I've missed), wouldn't the following break:

process p1 allocates anonymous page A
p1 dirties A
p1 forks p2, A now has a mapcount of 2
p2 VM_LOCKs A (something to prevent it being swapped)
page reclaim unmaps p1's pte, fails on p2
p2 exits, page_dirty does not get checked because of this patch
page has mapcount 0, PG_dirty is clear
Page reclaim can drop it without writing it to swap


Or am I misunderstanding something?

As far as the general idea goes, it might be possible to avoid the
check somehow, but you'd want to be pretty sure of yourself before
diverging the s390 path further from the common code base, no?

The "easy" way to do it might be just unconditionally mark the page
as dirty in this path (if the pte was writeable), so you can avoid
the page_test_dirty check and be sure of not missing the dirty bit.
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] Optimize page_remove_rmap for anon pages, Martin Schwidefsky, (Thu May 29, 9:56 am)
Re: [PATCH] Optimize page_remove_rmap for anon pages, Nick Piggin, (Mon Jun 2, 7:57 pm)
Re: [PATCH] Optimize page_remove_rmap for anon pages, Martin Schwidefsky, (Tue Jun 3, 4:06 am)
Re: [PATCH] Optimize page_remove_rmap for anon pages, Nick Piggin, (Tue Jun 3, 4:29 am)
Re: [PATCH] Optimize page_remove_rmap for anon pages, Martin Schwidefsky, (Tue Jun 3, 6:48 am)