Skip to contentSkip to conversation

+ mm-soft-dirty-bits-for-user-memory-changes-tracking-call-mmu-notifiers-when-write-protecting-ptes.patch added to -mm tree

PATCH [email protected] 1 participant 1 message May 21, 2013

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

Subject: + mm-soft-dirty-bits-for-user-memory-changes-tracking-call-mmu-notifiers-when-write-protecting-ptes.patch added to -mm tree
To: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Tue, 21 May 2013 14:04:21 -0700

The patch titled
Subject: soft-dirty: call mmu notifiers when write-protecting ptes
has been added to the -mm tree. Its filename is
mm-soft-dirty-bits-for-user-memory-changes-tracking-call-mmu-notifiers-when-write-protecting-ptes.patch

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated there every 3-4 working days

------------------------------------------------------
From: Pavel Emelyanov <[email protected]>
Subject: soft-dirty: call mmu notifiers when write-protecting ptes

As noticed by Xiao, since soft-dirty clear command modifies page tables we have to flush tlbs and call mmu notifiers. While the former is done by the clear_refs engine itself, the latter is to be done.

One thing to note about this -- in order not to call per-page invalidate notifier (_all_ address space is about to be changed), the _invalidate_range_start and _end are used. But for those start and end are not known exactly. To address this, the same trick as in exit_mmap() is used -- start is 0 and end is (unsigned long)-1.

Cc Matt Mackall <[email protected]>
Cc Xiao Guangrong <[email protected]>
Cc Glauber Costa <[email protected]>
Cc Marcelo Tosatti <[email protected]>
Cc KOSAKI Motohiro <[email protected]>
Cc Stephen Rothwell <[email protected]>

---

 fs/proc/task_mmu.c |    5 +++++
 1 file changed, 5 insertions(+)
fs/proc/task_mmu.c renamed from fs/proc/task_mmu.c~mm-soft-dirty-bits-for-user-memory-changes-tracking-call-mmu-notifiers-when-write-protecting-ptes +5 -0
diff -puN fs/proc/task_mmu.c~mm-soft-dirty-bits-for-user-memory-changes-tracking-call-mmu-notifiers-when-write-protecting-ptes fs/proc/task_mmu.c
@@ -11,6 +11,7 @@
 #include <linux/rmap.h>
 #include <linux/swap.h>
 #include <linux/swapops.h>
+#include <linux/mmu_notifier.h>
 
 #include <asm/elf.h>
 #include <asm/uaccess.h>
@@ -791,6 +792,8 @@ static ssize_t clear_refs_write(struct f
 			.private = &cp,
 		};
 		down_read(&mm->mmap_sem);
+		if (type == CLEAR_REFS_SOFT_DIRTY)
+			mmu_notifier_invalidate_range_start(mm, 0, -1);
 		for (vma = mm->mmap; vma; vma = vma->vm_next) {
 			cp.vma = vma;
 			if (is_vm_hugetlb_page(vma))
@@ -811,6 +814,8 @@ static ssize_t clear_refs_write(struct f
 			walk_page_range(vma->vm_start, vma->vm_end,
 					&clear_refs_walk);
 		}
+		if (type == CLEAR_REFS_SOFT_DIRTY)
+			mmu_notifier_invalidate_range_end(mm, 0, -1);
 		flush_tlb_mm(mm);
 		up_read(&mm->mmap_sem);
 		mmput(mm);

_

Patches currently in -mm which might be from [email protected] are

revert-selftest-add-simple-test-for-soft-dirty-bit.patch clear_refs-sanitize-accepted-commands-declaration.patch clear_refs-introduce-private-struct-for-mm_walk.patch pagemap-introduce-pagemap_entry_t-without-pmshift-bits.patch pagemap-introduce-pagemap_entry_t-without-pmshift-bits-v4.patch mm-soft-dirty-bits-for-user-memory-changes-tracking.patch mm-soft-dirty-bits-for-user-memory-changes-tracking-call-mmu-notifiers-when-write-protecting-ptes.patch pagemap-prepare-to-reuse-constant-bits-with-page-shift.patch