diff mbox series

[v5,1/8] memory-failure: fetch compound_head after pgmap_pfn_valid()

Message ID 20211112150824.11028-2-joao.m.martins@oracle.com (mailing list archive)
State Accepted
Commit 61e28cf0543c7d8e6ef88c3c305f727c5a21ba5b
Headers show
Series mm, dax: Introduce compound pages in devmap | expand

Commit Message

Joao Martins Nov. 12, 2021, 3:08 p.m. UTC
memory_failure_dev_pagemap() at the moment assumes base pages (e.g.
dax_lock_page()).  For devmap with compound pages fetch the
compound_head in case a tail page memory failure is being handled.

Currently this is a nop, but in the advent of compound pages in
dev_pagemap it allows memory_failure_dev_pagemap() to keep working.

Reported-by: Jane Chu <jane.chu@oracle.com>
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
Reviewed-by: Naoya Horiguchi <naoya.horiguchi@nec.com>
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Reviewed-by: Muchun Song <songmuchun@bytedance.com>
---
 mm/memory-failure.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index f64ebb6226cb..0c4b08da1a02 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1565,6 +1565,12 @@  static int memory_failure_dev_pagemap(unsigned long pfn, int flags,
 		goto out;
 	}
 
+	/*
+	 * Pages instantiated by device-dax (not filesystem-dax)
+	 * may be compound pages.
+	 */
+	page = compound_head(page);
+
 	/*
 	 * Prevent the inode from being freed while we are interrogating
 	 * the address_space, typically this would be handled by