* [PATCH] mm/rmap/mmu_notifier: restore mmu_notifier_invalidate_page() semantic
@ 2017-08-08 22:08 ` jglisse
0 siblings, 0 replies; 4+ messages in thread
From: jglisse @ 2017-08-08 22:08 UTC (permalink / raw)
To: linux-mm; +Cc: linux-kernel, Jérôme Glisse, Kirill A . Shutemov
From: Jérôme Glisse <jglisse@redhat.com>
Commit c7ab0d2fdc840266b39db94538f74207ec2afbf6 silently modified
semantic of mmu_notifier_invalidate_page() this patch restore it
to its previous semantic ie allowing to sleep inside invalidate_page()
callback.
Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
---
mm/rmap.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/mm/rmap.c b/mm/rmap.c
index 92070cfd63e9..fc1e2ab194c0 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -888,6 +888,8 @@ static bool page_mkclean_one(struct page *page, struct vm_area_struct *vma,
.address = address,
.flags = PVMW_SYNC,
};
+ unsigned long start = address, end = address;
+ bool invalidate = false;
int *cleaned = arg;
while (page_vma_mapped_walk(&pvmw)) {
@@ -927,11 +929,17 @@ static bool page_mkclean_one(struct page *page, struct vm_area_struct *vma,
}
if (ret) {
- mmu_notifier_invalidate_page(vma->vm_mm, address);
+ invalidate = true;
+ end = address;
(*cleaned)++;
}
}
+ if (invalidate) {
+ for (address = start; address <= end; address += PAGE_SIZE)
+ mmu_notifier_invalidate_page(vma->vm_mm, address);
+ }
+
return true;
}
@@ -1324,7 +1332,8 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
};
pte_t pteval;
struct page *subpage;
- bool ret = true;
+ bool ret = true, invalidate = false;
+ unsigned long start = address, end = address;
enum ttu_flags flags = (enum ttu_flags)arg;
/* munlock has nothing to gain from examining un-locked vmas */
@@ -1528,8 +1537,15 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
discard:
page_remove_rmap(subpage, PageHuge(page));
put_page(page);
- mmu_notifier_invalidate_page(mm, address);
+ end = address;
+ invalidate = true;
}
+
+ if (invalidate) {
+ for (address = start; address <= end; address += PAGE_SIZE)
+ mmu_notifier_invalidate_page(mm, address);
+ }
+
return ret;
}
--
2.13.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] mm/rmap/mmu_notifier: restore mmu_notifier_invalidate_page() semantic
@ 2017-08-08 22:08 ` jglisse
0 siblings, 0 replies; 4+ messages in thread
From: jglisse @ 2017-08-08 22:08 UTC (permalink / raw)
To: linux-mm; +Cc: linux-kernel, Jérôme Glisse, Kirill A . Shutemov
From: JA(C)rA'me Glisse <jglisse@redhat.com>
Commit c7ab0d2fdc840266b39db94538f74207ec2afbf6 silently modified
semantic of mmu_notifier_invalidate_page() this patch restore it
to its previous semantic ie allowing to sleep inside invalidate_page()
callback.
Signed-off-by: JA(C)rA'me Glisse <jglisse@redhat.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
---
mm/rmap.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/mm/rmap.c b/mm/rmap.c
index 92070cfd63e9..fc1e2ab194c0 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -888,6 +888,8 @@ static bool page_mkclean_one(struct page *page, struct vm_area_struct *vma,
.address = address,
.flags = PVMW_SYNC,
};
+ unsigned long start = address, end = address;
+ bool invalidate = false;
int *cleaned = arg;
while (page_vma_mapped_walk(&pvmw)) {
@@ -927,11 +929,17 @@ static bool page_mkclean_one(struct page *page, struct vm_area_struct *vma,
}
if (ret) {
- mmu_notifier_invalidate_page(vma->vm_mm, address);
+ invalidate = true;
+ end = address;
(*cleaned)++;
}
}
+ if (invalidate) {
+ for (address = start; address <= end; address += PAGE_SIZE)
+ mmu_notifier_invalidate_page(vma->vm_mm, address);
+ }
+
return true;
}
@@ -1324,7 +1332,8 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
};
pte_t pteval;
struct page *subpage;
- bool ret = true;
+ bool ret = true, invalidate = false;
+ unsigned long start = address, end = address;
enum ttu_flags flags = (enum ttu_flags)arg;
/* munlock has nothing to gain from examining un-locked vmas */
@@ -1528,8 +1537,15 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
discard:
page_remove_rmap(subpage, PageHuge(page));
put_page(page);
- mmu_notifier_invalidate_page(mm, address);
+ end = address;
+ invalidate = true;
}
+
+ if (invalidate) {
+ for (address = start; address <= end; address += PAGE_SIZE)
+ mmu_notifier_invalidate_page(mm, address);
+ }
+
return ret;
}
--
2.13.4
--
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>
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mm/rmap/mmu_notifier: restore mmu_notifier_invalidate_page() semantic
2017-08-08 22:08 ` jglisse
@ 2017-08-09 10:27 ` Kirill A. Shutemov
-1 siblings, 0 replies; 4+ messages in thread
From: Kirill A. Shutemov @ 2017-08-09 10:27 UTC (permalink / raw)
To: jglisse; +Cc: linux-mm, linux-kernel, Kirill A . Shutemov
On Tue, Aug 08, 2017 at 06:08:20PM -0400, jglisse@redhat.com wrote:
> From: Jérôme Glisse <jglisse@redhat.com>
>
> Commit c7ab0d2fdc840266b39db94538f74207ec2afbf6 silently modified
> semantic of mmu_notifier_invalidate_page() this patch restore it
> to its previous semantic ie allowing to sleep inside invalidate_page()
> callback.
>
> Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
The issue in page_mkclean_one() was addressed recently by this:
http://lkml.kernel.org/r/20170804134928.l4klfcnqatni7vsc@black.fi.intel.com
(I think mmu_notifier_invalidate_range() it better in the situation, right?)
But I've missed try_to_unmap_one(). Could you prepare patch for this one?
--
Kirill A. Shutemov
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm/rmap/mmu_notifier: restore mmu_notifier_invalidate_page() semantic
@ 2017-08-09 10:27 ` Kirill A. Shutemov
0 siblings, 0 replies; 4+ messages in thread
From: Kirill A. Shutemov @ 2017-08-09 10:27 UTC (permalink / raw)
To: jglisse; +Cc: linux-mm, linux-kernel, Kirill A . Shutemov
On Tue, Aug 08, 2017 at 06:08:20PM -0400, jglisse@redhat.com wrote:
> From: Jerome Glisse <jglisse@redhat.com>
>
> Commit c7ab0d2fdc840266b39db94538f74207ec2afbf6 silently modified
> semantic of mmu_notifier_invalidate_page() this patch restore it
> to its previous semantic ie allowing to sleep inside invalidate_page()
> callback.
>
> Signed-off-by: Jerome Glisse <jglisse@redhat.com>
> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
The issue in page_mkclean_one() was addressed recently by this:
http://lkml.kernel.org/r/20170804134928.l4klfcnqatni7vsc@black.fi.intel.com
(I think mmu_notifier_invalidate_range() it better in the situation, right?)
But I've missed try_to_unmap_one(). Could you prepare patch for this one?
--
Kirill A. Shutemov
--
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>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-08-09 10:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-08 22:08 [PATCH] mm/rmap/mmu_notifier: restore mmu_notifier_invalidate_page() semantic jglisse
2017-08-08 22:08 ` jglisse
2017-08-09 10:27 ` Kirill A. Shutemov
2017-08-09 10:27 ` Kirill A. Shutemov
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.