linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/2] mm: don't install PMD mappings when THPs are disabled by the hw/process/vma
@ 2024-10-11 10:24 David Hildenbrand
  2024-10-11 10:24 ` [PATCH v1 1/2] mm: huge_memory: add vma_thp_disabled() and thp_disabled_by_hw() David Hildenbrand
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: David Hildenbrand @ 2024-10-11 10:24 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-mm, kvm, David Hildenbrand, Andrew Morton, Hugh Dickins,
	Thomas Huth, Matthew Wilcox (Oracle),
	Ryan Roberts, Christian Borntraeger, Janosch Frank,
	Claudio Imbrenda, Kefeng Wang

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 <akpm@linux-foundation.org>
Cc: Hugh Dickins <hughd@google.com>
Cc: Thomas Huth <thuth@redhat.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Janosch Frank <frankja@linux.ibm.com>
Cc: Claudio Imbrenda <imbrenda@linux.ibm.com>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>

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(-)

-- 
2.46.1



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-10-11 11:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-11 10:24 [PATCH v1 0/2] mm: don't install PMD mappings when THPs are disabled by the hw/process/vma David Hildenbrand
2024-10-11 10:24 ` [PATCH v1 1/2] mm: huge_memory: add vma_thp_disabled() and thp_disabled_by_hw() David Hildenbrand
2024-10-11 11:21   ` Ryan Roberts
2024-10-11 10:24 ` [PATCH v1 2/2] mm: don't install PMD mappings when THPs are disabled by the hw/process/vma David Hildenbrand
2024-10-11 11:29   ` Ryan Roberts
2024-10-11 11:33     ` David Hildenbrand
2024-10-11 11:36       ` Ryan Roberts
2024-10-11 11:40         ` David Hildenbrand
2024-10-11 11:39 ` [PATCH v1 0/2] " Thomas Huth
2024-10-11 11:43   ` David Hildenbrand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox