Merge tag 'iommu-fixes-v4.17-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / mm / memory-failure.c
index 8291b75..9d142b9 100644 (file)
@@ -502,6 +502,7 @@ static const char * const action_page_types[] = {
        [MF_MSG_POISONED_HUGE]          = "huge page already hardware poisoned",
        [MF_MSG_HUGE]                   = "huge page",
        [MF_MSG_FREE_HUGE]              = "free huge page",
+       [MF_MSG_NON_PMD_HUGE]           = "non-pmd-sized huge page",
        [MF_MSG_UNMAP_FAILED]           = "unmapping failed page",
        [MF_MSG_DIRTY_SWAPCACHE]        = "dirty swapcache page",
        [MF_MSG_CLEAN_SWAPCACHE]        = "clean swapcache page",
@@ -1084,6 +1085,21 @@ static int memory_failure_hugetlb(unsigned long pfn, int flags)
                return 0;
        }
 
+       /*
+        * TODO: hwpoison for pud-sized hugetlb doesn't work right now, so
+        * simply disable it. In order to make it work properly, we need
+        * make sure that:
+        *  - conversion of a pud that maps an error hugetlb into hwpoison
+        *    entry properly works, and
+        *  - other mm code walking over page table is aware of pud-aligned
+        *    hwpoison entries.
+        */
+       if (huge_page_size(page_hstate(head)) > PMD_SIZE) {
+               action_result(pfn, MF_MSG_NON_PMD_HUGE, MF_IGNORED);
+               res = -EBUSY;
+               goto out;
+       }
+
        if (!hwpoison_user_mappings(p, pfn, flags, &head)) {
                action_result(pfn, MF_MSG_UNMAP_FAILED, MF_IGNORED);
                res = -EBUSY;
@@ -1471,7 +1487,7 @@ int unpoison_memory(unsigned long pfn)
 }
 EXPORT_SYMBOL(unpoison_memory);
 
-static struct page *new_page(struct page *p, unsigned long private, int **x)
+static struct page *new_page(struct page *p, unsigned long private)
 {
        int nid = page_to_nid(p);