Skip to content

mm: don't install PMD mappings when THPs are disabled by the hw/process/vma

David Hildenbrand kvm linux-mm lkml 1 version Applied

Status from this message: [merged mm-hotfixes-stable] mm-dont-install-pmd-mappings-when-thps-are-disabled-by-the-hw-process-vma.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 7 repliesApplied 2/2

Patches in v1 All 2 applied

#Subject and filesSizeRepliesApplied
1/2mm: huge_memory: add vma_thp_disabled() and thp_disabled_by_hw()include/linux/huge_mm.h mm/huge_memory.c mm/shmem.c+20 -181 replyApplied
2/2mm: don't install PMD mappings when THPs are disabled by the hw/process/vmamm/memory.c+9 -04 repliesApplied

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchRyan RobertsThomas Huth
SeriesT-b
1/2R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH v1 0/2] mm: don't install PMD mappings when THPs are disabled by the hw/process/vma

During testing, it was found that we can get PMD mappings in processes where THP (and more precisely, PMD mappings) are supposed to be disabled. While it works as expected for anon+shmem, the pagecache is the problematic bit.

For s390 KVM this currently means that a VM backed by a file located on filesystem with large folio support can crash when KVM tries accessing the problematic page, because the readahead logic might decide to use a PMD-sized THP and faulting it into the page tables will install a PMD mapping, something that s390 KVM cannot tolerate.

This might also be a problem with HW that does not support PMD mappings, but I did not try reproducing it.

Fix it by respecting the ways to disable THPs when deciding whether we can install a PMD mapping. khugepaged should already be taking care of not collapsing if THPs are effectively disabled for the hw/process/vma.

An earlier patch was tested by Thomas Huth, this one still needs to be retested; sending it out already.

Cc Andrew Morton <[email protected]>
Cc Hugh Dickins <[email protected]>
Cc Thomas Huth <[email protected]>
Cc Matthew Wilcox (Oracle) <[email protected]>
Cc Ryan Roberts <[email protected]>
Cc Christian Borntraeger <[email protected]>
Cc Janosch Frank <[email protected]>
Cc Claudio Imbrenda <[email protected]>
Cc Kefeng Wang <[email protected]>

David Hildenbrand (1):
mm: don't install PMD mappings when THPs are disabled by the
hw/process/vma

Kefeng Wang (1):
mm: huge_memory: add vma_thp_disabled() and thp_disabled_by_hw()

 include/linux/huge_mm.h | 18 ++++++++++++++++++
 mm/huge_memory.c        | 13 +------------
 mm/memory.c             |  9 +++++++++
 mm/shmem.c              |  7 +------
 4 files changed, 29 insertions(+), 18 deletions(-)
Signature · 1 line
2.46.1