linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Map MAP_STACK to VM_NOHUGEPAGE only if THP is enabled
@ 2025-05-06 13:44 Ignacio Moreno Gonzalez via B4 Relay
  2025-05-06 13:44 ` [PATCH v2 1/2] mm: mmap: map " Ignacio Moreno Gonzalez via B4 Relay
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Ignacio Moreno Gonzalez via B4 Relay @ 2025-05-06 13:44 UTC (permalink / raw)
  To: lorenzo.stoakes
  Cc: Liam.Howlett, akpm, yang, linux-mm, linux-kernel,
	Ignacio Moreno Gonzalez, stable, Matthew Wilcox

... and make setting MADV_NOHUGEPAGE with madvise() into a no-op if THP
is not enabled.

I discovered this issue when trying to use the tool CRIU to checkpoint
and restore a container. Our running kernel is compiled without
CONFIG_TRANSPARENT_HUGETABLES. CRIU parses the output of
/proc/<pid>/smaps and saves the "nh" flag. When trying to restore the
container, CRIU fails to restore the "nh" mappings, since madvise()
MADV_NOHUGEPAGE always returns an error because
CONFIG_TRANSPARENT_HUGETABLES is not defined.

These patches:
- Avoid mapping MAP_STACK to VM_NOHUGEPAGE if !THP
- Avoid returning an error when calling madvise() with MADV_NOHUGEPAGE
  if !THP

Signed-off-by: Ignacio Moreno Gonzalez <Ignacio.MorenoGonzalez@kuka.com>
---
Changes in v2:
- [Patch 1/2] Use '#ifdef' instead of '#if defined(...)'
- [Patch 1/2] Add 'Fixes: c4608d1bf7c6...'
- Create [Patch 2/2]

- Link to v1: https://lore.kernel.org/r/20250502-map-map_stack-to-vm_nohugepage-only-if-thp-is-enabled-v1-1-113cc634cd51@kuka.com

---
Ignacio Moreno Gonzalez (2):
      mm: mmap: map MAP_STACK to VM_NOHUGEPAGE only if THP is enabled
      mm: madvise: no-op for MADV_NOHUGEPAGE if THP is disabled

 include/linux/huge_mm.h | 6 ++++++
 include/linux/mman.h    | 2 ++
 2 files changed, 8 insertions(+)
---
base-commit: fc96b232f8e7c0a6c282f47726b2ff6a5fb341d2
change-id: 20250428-map-map_stack-to-vm_nohugepage-only-if-thp-is-enabled-ce40a1de095d

Best regards,
-- 
Ignacio Moreno Gonzalez <Ignacio.MorenoGonzalez@kuka.com>




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

end of thread, other threads:[~2025-05-07 22:38 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-06 13:44 [PATCH v2 0/2] Map MAP_STACK to VM_NOHUGEPAGE only if THP is enabled Ignacio Moreno Gonzalez via B4 Relay
2025-05-06 13:44 ` [PATCH v2 1/2] mm: mmap: map " Ignacio Moreno Gonzalez via B4 Relay
2025-05-06 16:00   ` Liam R. Howlett
2025-05-06 23:43   ` Andrew Morton
2025-05-06 13:44 ` [PATCH v2 2/2] mm: madvise: no-op for MADV_NOHUGEPAGE if THP is disabled Ignacio Moreno Gonzalez via B4 Relay
2025-05-06 16:00   ` Liam R. Howlett
2025-05-06 23:40   ` Andrew Morton
2025-05-07 11:44     ` Ignacio Moreno Gonzalez
2025-05-07 15:57       ` Yang Shi
2025-05-07 16:11         ` Ignacio Moreno Gonzalez
2025-05-07 22:38           ` Yang Shi
2025-05-06 14:28 ` [PATCH v2 0/2] Map MAP_STACK to VM_NOHUGEPAGE only if THP is enabled Lorenzo Stoakes
2025-05-06 15:12   ` Ignacio Moreno Gonzalez
2025-05-06 15:14     ` Lorenzo Stoakes

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