]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
khugepaged: collapse_pte_mapped_thp() flush the right range
authorHugh Dickins <hughd@google.com>
Fri, 7 Aug 2020 06:26:15 +0000 (23:26 -0700)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Fri, 4 Sep 2020 19:29:45 +0000 (16:29 -0300)
commit1eaeb33ffb600e29d4078526f0c9968259c53e5b
treeb07efd799177b9b42a41525b70d9353f7fe522ee
parent26043519ef60ae3251501b779a7e2bc3c7748eee
khugepaged: collapse_pte_mapped_thp() flush the right range

BugLink: https://bugs.launchpad.net/bugs/1892899
commit 723a80dafed5c95889d48baab9aa433a6ffa0b4e upstream.

pmdp_collapse_flush() should be given the start address at which the huge
page is mapped, haddr: it was given addr, which at that point has been
used as a local variable, incremented to the end address of the extent.

Found by source inspection while chasing a hugepage locking bug, which I
then could not explain by this.  At first I thought this was very bad;
then saw that all of the page translations that were not flushed would
actually still point to the right pages afterwards, so harmless; then
realized that I know nothing of how different architectures and models
cache intermediate paging structures, so maybe it matters after all -
particularly since the page table concerned is immediately freed.

Much easier to fix than to think about.

Fixes: 27e1f8273113 ("khugepaged: enable collapse pmd for pte-mapped THP")
Signed-off-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Song Liu <songliubraving@fb.com>
Cc: <stable@vger.kernel.org> [5.4+]
Link: http://lkml.kernel.org/r/alpine.LSU.2.11.2008021204390.27773@eggly.anvils
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
mm/khugepaged.c