Skip to content

Commit

Permalink
mm, dev_pagemap: Do not clear ->mapping on final put
Browse files Browse the repository at this point in the history
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: d2c997c ("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>
  • Loading branch information
Dan Williams authored and Dave Jiang committed Jul 23, 2018
1 parent 86a6681 commit 2fa147b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 0 additions & 1 deletion kernel/memremap.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,6 @@ void __put_devmap_managed_page(struct page *page)
__ClearPageActive(page);
__ClearPageWaiters(page);

page->mapping = NULL;
mem_cgroup_uncharge(page);

page->pgmap->page_free(page, page->pgmap->data);
Expand Down
2 changes: 2 additions & 0 deletions mm/hmm.c
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,8 @@ static void hmm_devmem_free(struct page *page, void *data)
{
struct hmm_devmem *devmem = data;

page->mapping = NULL;

devmem->ops->free(devmem, page);
}

Expand Down

0 comments on commit 2fa147b

Please sign in to comment.