linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@openvz.org>
To: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Cc: hughd@google.com, xemul@parallels.com, akpm@linux-foundation.org,
	gorcunov@openvz.org
Subject: [patch 1/4] mm: Make freshly remapped file pages being softdirty unconditionally
Date: Mon, 24 Mar 2014 16:28:39 +0400	[thread overview]
Message-ID: <20140324125925.911631019@openvz.org> (raw)
In-Reply-To: <20140324122838.490106581@openvz.org>

[-- Attachment #1: mm-file-pte-softdirty-update-2 --]
[-- Type: text/plain, Size: 1769 bytes --]

Hugh reported:

 | I noticed your soft_dirty work in install_file_pte(): which looked
 | good at first, until I realized that it's propagating the soft_dirty
 | of a pte it's about to zap completely, to the unrelated entry it's
 | about to insert in its place.  Which seems very odd to me.

Indeed this code ends up being nop in result -- pte_file_mksoft_dirty()
operates with pte_t argument and returns new pte_t which were never
used after. After looking more I think what we need is to soft-dirtify
all newely remapped file pages because it should look like a new mapping
for memory tracker.

Reported-by: Hugh Dickins <hughd@google.com>
CC: Pavel Emelyanov <xemul@parallels.com>
CC: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
 mm/fremap.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Index: linux-2.6.git/mm/fremap.c
===================================================================
--- linux-2.6.git.orig/mm/fremap.c
+++ linux-2.6.git/mm/fremap.c
@@ -66,13 +66,10 @@ static int install_file_pte(struct mm_st
 
 	ptfile = pgoff_to_pte(pgoff);
 
-	if (!pte_none(*pte)) {
-		if (pte_present(*pte) && pte_soft_dirty(*pte))
-			pte_file_mksoft_dirty(ptfile);
+	if (!pte_none(*pte))
 		zap_pte(mm, vma, addr, pte);
-	}
 
-	set_pte_at(mm, addr, pte, ptfile);
+	set_pte_at(mm, addr, pte, pte_file_mksoft_dirty(ptfile));
 	/*
 	 * We don't need to run update_mmu_cache() here because the "file pte"
 	 * being installed by install_file_pte() is not a real pte - it's a

--
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:[~2014-03-24 12:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-24 12:28 [patch 0/4] mm: A few memory tracker fixes Cyrill Gorcunov
2014-03-24 12:28 ` Cyrill Gorcunov [this message]
2014-03-24 12:28 ` [patch 2/4] mm: Dont forget to set softdirty on file mapped fault Cyrill Gorcunov
2014-04-14 22:27   ` Andrew Morton
2014-04-14 22:33     ` Cyrill Gorcunov
2014-04-14 22:38       ` Cyrill Gorcunov
2014-04-14 22:43         ` Andrew Morton
2014-03-24 12:28 ` [patch 3/4] mm: Dont forget to save file map softdiry bit on unmap Cyrill Gorcunov
2014-03-24 12:28 ` [patch 4/4] mm: Clear VM_SOFTDIRTY flag inside clear_refs_write instead of clear_soft_dirty Cyrill Gorcunov
2014-04-15 18:06   ` Andrew Morton
2014-04-15 18:29     ` Cyrill Gorcunov
2014-04-15 18:44       ` Andrew Morton
2014-04-15 18:48         ` Cyrill Gorcunov
2014-04-15 18:52           ` Andrew Morton
2014-04-16  7:05             ` Cyrill Gorcunov

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=20140324125925.911631019@openvz.org \
    --to=gorcunov@openvz.org \
    --cc=akpm@linux-foundation.org \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=xemul@parallels.com \
    /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