diff options
author | Laura Abbott <labbott@redhat.com> | 2018-03-15 09:31:18 -0700 |
---|---|---|
committer | Laura Abbott <labbott@redhat.com> | 2018-03-15 09:42:53 -0700 |
commit | 67c1a82ba386cc8ce05733ac75fe2ff0631fea0e (patch) | |
tree | 7b8be72b710e897be5c4bda3591c952b0c614397 /mm-khugepaged-Convert-VM_BUG_ON-to-collapse-fail.patch | |
parent | 3f91bd12ee8d88ee1779ffdebc8bfe753fcc27da (diff) | |
download | kernel-67c1a82ba386cc8ce05733ac75fe2ff0631fea0e.tar.gz kernel-67c1a82ba386cc8ce05733ac75fe2ff0631fea0e.tar.xz kernel-67c1a82ba386cc8ce05733ac75fe2ff0631fea0e.zip |
Linux v4.15.10
Fix for dock booting (rhbz 1549042)
Fix THP bug (rhbz 1546709)
Diffstat (limited to 'mm-khugepaged-Convert-VM_BUG_ON-to-collapse-fail.patch')
-rw-r--r-- | mm-khugepaged-Convert-VM_BUG_ON-to-collapse-fail.patch | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/mm-khugepaged-Convert-VM_BUG_ON-to-collapse-fail.patch b/mm-khugepaged-Convert-VM_BUG_ON-to-collapse-fail.patch new file mode 100644 index 000000000..c5d3a0c0c --- /dev/null +++ b/mm-khugepaged-Convert-VM_BUG_ON-to-collapse-fail.patch @@ -0,0 +1,51 @@ +From patchwork Thu Mar 15 15:23:53 2018 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: mm/khugepaged: Convert VM_BUG_ON() to collapse fail +From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> +X-Patchwork-Id: 10284785 +Message-Id: <20180315152353.27989-1-kirill.shutemov@linux.intel.com> +To: Andrew Morton <akpm@linux-foundation.org> +Cc: Laura Abbott <labbott@redhat.com>, linux-mm@kvack.org, + linux-kernel@vger.kernel.org, + "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> +Date: Thu, 15 Mar 2018 18:23:53 +0300 + +khugepaged is not yet able to convert PTE-mapped huge pages back to PMD +mapped. We do not collapse such pages. See check khugepaged_scan_pmd(). + +But if between khugepaged_scan_pmd() and __collapse_huge_page_isolate() +somebody managed to instantiate THP in the range and then split the PMD +back to PTEs we would have a problem -- VM_BUG_ON_PAGE(PageCompound(page)) +will get triggered. + +It's possible since we drop mmap_sem during collapse to re-take for +write. + +Replace the VM_BUG_ON() with graceful collapse fail. + +Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> +Fixes: b1caa957ae6d ("khugepaged: ignore pmd tables with THP mapped with ptes") +--- + mm/khugepaged.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/mm/khugepaged.c b/mm/khugepaged.c +index b7e2268dfc9a..c15da1ea7e63 100644 +--- a/mm/khugepaged.c ++++ b/mm/khugepaged.c +@@ -530,7 +530,12 @@ static int __collapse_huge_page_isolate(struct vm_area_struct *vma, + goto out; + } + +- VM_BUG_ON_PAGE(PageCompound(page), page); ++ /* TODO: teach khugepaged to collapse THP mapped with pte */ ++ if (PageCompound(page)) { ++ result = SCAN_PAGE_COMPOUND; ++ goto out; ++ } ++ + VM_BUG_ON_PAGE(!PageAnon(page), page); + + /* |