All of lore.kernel.org
 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 4/4] mm: Clear VM_SOFTDIRTY flag inside clear_refs_write instead of clear_soft_dirty
Date: Mon, 24 Mar 2014 16:28:42 +0400	[thread overview]
Message-ID: <20140324125926.204897920@openvz.org> (raw)
In-Reply-To: 20140324122838.490106581@openvz.org

[-- Attachment #1: mm-vma-softdirty-clean-vma-softdirty-bit --]
[-- Type: text/plain, Size: 1444 bytes --]

The clear_refs_write is called earlier than clear_soft_dirty and it is
more natural to clear VM_SOFTDIRTY (which belongs to VMA entry but not
PTEs) that early instead of clearing it a way deeper inside call chain.

CC: Pavel Emelyanov <xemul@parallels.com>
CC: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
 fs/proc/task_mmu.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Index: linux-2.6.git/fs/proc/task_mmu.c
===================================================================
--- linux-2.6.git.orig/fs/proc/task_mmu.c
+++ linux-2.6.git/fs/proc/task_mmu.c
@@ -736,9 +736,6 @@ static inline void clear_soft_dirty(stru
 		ptent = pte_file_clear_soft_dirty(ptent);
 	}
 
-	if (vma->vm_flags & VM_SOFTDIRTY)
-		vma->vm_flags &= ~VM_SOFTDIRTY;
-
 	set_pte_at(vma->vm_mm, addr, pte, ptent);
 #endif
 }
@@ -843,6 +840,10 @@ static ssize_t clear_refs_write(struct f
 				continue;
 			if (type == CLEAR_REFS_MAPPED && !vma->vm_file)
 				continue;
+			if (type == CLEAR_REFS_SOFT_DIRTY) {
+				if (vma->vm_flags & VM_SOFTDIRTY)
+					vma->vm_flags &= ~VM_SOFTDIRTY;
+			}
 			walk_page_range(vma->vm_start, vma->vm_end,
 					&clear_refs_walk);
 		}

--
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>

WARNING: multiple messages have this Message-ID (diff)
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 4/4] mm: Clear VM_SOFTDIRTY flag inside clear_refs_write instead of clear_soft_dirty
Date: Mon, 24 Mar 2014 16:28:42 +0400	[thread overview]
Message-ID: <20140324125926.204897920@openvz.org> (raw)
In-Reply-To: 20140324122838.490106581@openvz.org

[-- Attachment #1: mm-vma-softdirty-clean-vma-softdirty-bit --]
[-- Type: text/plain, Size: 1219 bytes --]

The clear_refs_write is called earlier than clear_soft_dirty and it is
more natural to clear VM_SOFTDIRTY (which belongs to VMA entry but not
PTEs) that early instead of clearing it a way deeper inside call chain.

CC: Pavel Emelyanov <xemul@parallels.com>
CC: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
 fs/proc/task_mmu.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Index: linux-2.6.git/fs/proc/task_mmu.c
===================================================================
--- linux-2.6.git.orig/fs/proc/task_mmu.c
+++ linux-2.6.git/fs/proc/task_mmu.c
@@ -736,9 +736,6 @@ static inline void clear_soft_dirty(stru
 		ptent = pte_file_clear_soft_dirty(ptent);
 	}
 
-	if (vma->vm_flags & VM_SOFTDIRTY)
-		vma->vm_flags &= ~VM_SOFTDIRTY;
-
 	set_pte_at(vma->vm_mm, addr, pte, ptent);
 #endif
 }
@@ -843,6 +840,10 @@ static ssize_t clear_refs_write(struct f
 				continue;
 			if (type == CLEAR_REFS_MAPPED && !vma->vm_file)
 				continue;
+			if (type == CLEAR_REFS_SOFT_DIRTY) {
+				if (vma->vm_flags & VM_SOFTDIRTY)
+					vma->vm_flags &= ~VM_SOFTDIRTY;
+			}
 			walk_page_range(vma->vm_start, vma->vm_end,
 					&clear_refs_walk);
 		}


  parent reply	other threads:[~2014-03-24 12:59 UTC|newest]

Thread overview: 30+ 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
2014-03-24 12:28 ` [patch 1/4] mm: Make freshly remapped file pages being softdirty unconditionally Cyrill Gorcunov
2014-03-24 12:28   ` Cyrill Gorcunov
2014-03-24 12:28 ` [patch 2/4] mm: Dont forget to set softdirty on file mapped fault Cyrill Gorcunov
2014-03-24 12:28   ` Cyrill Gorcunov
2014-04-14 22:27   ` Andrew Morton
2014-04-14 22:27     ` Andrew Morton
2014-04-14 22:33     ` Cyrill Gorcunov
2014-04-14 22:33       ` Cyrill Gorcunov
2014-04-14 22:38       ` Cyrill Gorcunov
2014-04-14 22:38         ` Cyrill Gorcunov
2014-04-14 22:43         ` Andrew Morton
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   ` Cyrill Gorcunov
2014-03-24 12:28 ` Cyrill Gorcunov [this message]
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:06     ` Andrew Morton
2014-04-15 18:29     ` Cyrill Gorcunov
2014-04-15 18:29       ` Cyrill Gorcunov
2014-04-15 18:44       ` Andrew Morton
2014-04-15 18:44         ` Andrew Morton
2014-04-15 18:48         ` Cyrill Gorcunov
2014-04-15 18:48           ` Cyrill Gorcunov
2014-04-15 18:52           ` Andrew Morton
2014-04-15 18:52             ` Andrew Morton
2014-04-16  7:05             ` Cyrill Gorcunov
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=20140324125926.204897920@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.