linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: Hugh Dickins <hugh@veritas.com>
Cc: linux-mm@kvack.org
Subject: Re: s390's PageSwapCache test
Date: Sat, 02 Aug 2008 18:20:31 +0200	[thread overview]
Message-ID: <1217694031.22955.14.camel@localhost> (raw)
In-Reply-To: <Pine.LNX.4.64.0808020944330.1992@blonde.site>

Hi Hugh,

On Sat, 2008-08-02 at 10:05 +0100, Hugh Dickins wrote:
> I'm slightly bothered by that PageSwapCache() test you've just added
> in page_remove_rmap(), before s390's page_test_dirty():
> 
> 		if ((!PageAnon(page) || PageSwapCache(page)) &&
> 		    page_test_dirty(page)) {
> 			page_clear_dirty(page);
> 			set_page_dirty(page);
> 		}
> 
> It's not wrong; but if it's necessary, then I need to understand why;
> and if it's unnecessary, then we'd do better to remove it (optimizing
> your optimization a little).

I want to play safe. I can conclude that the page dirty bit is of no
interest if the page is a purely anonymous page without a backing. That
is what the test checks for.

> I believe it's unnecessary: it is possible, yes, to arrive here and
> find the anon page dirty with respect to what's on swap disk; but
> because anon pages are COWed, never sharing modification with other
> users, that will only be so if we're the only user of that page, and
> about to free it, in which case no point in doing the set_page_dirty().

Hmm, what about the following sequence:
1) a page is added to the swap
2) the page is dirtied again
3) the process forks
4) the first process does an mlock
5) vmscan succeeds in replacing the pte of the second process with a
swap entry but fails for the pte of the first process.
6) the first process exists.

If the PageSwapCache() check is missing zap_pte_range() will drop the
last pte for the page but won't transfer the dirty bit.
Wouldn't that break?

> For a very similar case, see the PageAnon() test in zap_pte_range(),
> where we also skip the set_page_dirty().

-- 
blue skies,
  Martin.

"Reality continues to ruin my life." - Calvin.


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2008-08-02 16:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-02  9:05 Hugh Dickins
2008-08-02 16:20 ` Martin Schwidefsky [this message]
2008-08-02 18:44   ` Hugh Dickins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1217694031.22955.14.camel@localhost \
    --to=schwidefsky@de.ibm.com \
    --cc=hugh@veritas.com \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox