aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2018-07-14 00:50:01 -0400
committerDave Jiang <dave.jiang@intel.com>2018-07-23 13:37:39 -0400
commit2fa147bdbf672c53386a8f5f2c7fe358004c3ef8 (patch)
tree7cf0718fabe780c0faf9337a6f8262826cb1dc37
parent86a66810baa87e5d1c93a51f71d36c7f71fe3113 (diff)
mm, dev_pagemap: Do not clear ->mapping on final put
MEMORY_DEVICE_FS_DAX relies on typical page semantics whereby ->mapping is only ever cleared by truncation, not final put. Without this fix dax pages may forget their mapping association at the end of every page pin event. Move this atypical behavior that HMM wants into the HMM ->page_free() callback. Cc: <stable@vger.kernel.org> Cc: Jan Kara <jack@suse.cz> Cc: Jérôme Glisse <jglisse@redhat.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Ross Zwisler <ross.zwisler@linux.intel.com> Fixes: d2c997c0f145 ("fs, dax: use page->mapping...") Signed-off-by: Dan Williams <dan.j.williams@intel.com> Acked-by: Jérôme Glisse <jglisse@redhat.com> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
-rw-r--r--kernel/memremap.c1
-rw-r--r--mm/hmm.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/kernel/memremap.c b/kernel/memremap.c
index 5857267a4af5..62603634a1d2 100644
--- a/kernel/memremap.c
+++ b/kernel/memremap.c
@@ -339,7 +339,6 @@ void __put_devmap_managed_page(struct page *page)
339 __ClearPageActive(page); 339 __ClearPageActive(page);
340 __ClearPageWaiters(page); 340 __ClearPageWaiters(page);
341 341
342 page->mapping = NULL;
343 mem_cgroup_uncharge(page); 342 mem_cgroup_uncharge(page);
344 343
345 page->pgmap->page_free(page, page->pgmap->data); 344 page->pgmap->page_free(page, page->pgmap->data);
diff --git a/mm/hmm.c b/mm/hmm.c
index de7b6bf77201..f9d1d89dec4d 100644
--- a/mm/hmm.c
+++ b/mm/hmm.c
@@ -963,6 +963,8 @@ static void hmm_devmem_free(struct page *page, void *data)
963{ 963{
964 struct hmm_devmem *devmem = data; 964 struct hmm_devmem *devmem = data;
965 965
966 page->mapping = NULL;
967
966 devmem->ops->free(devmem, page); 968 devmem->ops->free(devmem, page);
967} 969}
968 970