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....@oracle.com>
Signed-off-by: Joao Martins <joao.m.mart...@oracle.com>
Reviewed-by: Naoya Horiguchi <naoya.horigu...@nec.com>
Reviewed-by: Dan Williams <dan.j.willi...@intel.com>
Reviewed-by: Muchun Song <songmuc...@bytedance.com>
---
 mm/memory-failure.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 60df8fcd0444..beee19a5aa0f 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1538,6 +1538,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
-- 
2.17.1


Reply via email to