From: jglisse@redhat.com
To: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org,
"Jérôme Glisse" <jglisse@redhat.com>,
"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>
Subject: [PATCH] mm/rmap/mmu_notifier: restore mmu_notifier_invalidate_page() semantic
Date: Tue, 8 Aug 2017 18:08:20 -0400 [thread overview]
Message-ID: <20170808220820.16503-1-jglisse@redhat.com> (raw)
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>
next reply other threads:[~2017-08-08 22:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-08 22:08 jglisse [this message]
2017-08-09 10:27 ` Kirill A. Shutemov
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=20170808220820.16503-1-jglisse@redhat.com \
--to=jglisse@redhat.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--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