History

mm/huge_memory: respect MADV_COLLAPSE with PR_THP_DISABLE_EXCEPT_ADVISED

Let's allow for making MADV_COLLAPSE succeed on areas that neither have VM_HUGEPAGE nor VM_NOHUGEPAGE when we have THP disabled unless explicitly advised (PR_THP_DISABLE_EXCEPT_ADVISED). MADV_COLLAPSE is a clear advice that we want to collapse. Note that we still respect the VM_NOHUGEPAGE flag, just like MADV_COLLAPSE always does. So consequently, MADV_COLLAPSE is now only refused on VM_NOHUGEPAGE with PR_THP_DISABLE_EXCEPT_ADVISED, including for shmem.

David Hildenbrand committed 1 year ago

Commit 8cdc4d21 parent 1f1c0615 files · +16 −7Browse files

Showing the changes to include/uapi (1 of 5 files). Show all

Unified · Split

include/uapi/linux/prctl.h+1−1
@@ -185,7 +185,7 @@ struct prctl_mm_map { · 184 unmodified lines
185#define PR_SET_THP_DISABLE 41185#define PR_SET_THP_DISABLE 41
186/*186/*
187 * Don't disable THPs when explicitly advised (e.g., MADV_HUGEPAGE /187 * Don't disable THPs when explicitly advised (e.g., MADV_HUGEPAGE /
188 * VM_HUGEPAGE).188 * VM_HUGEPAGE, MADV_COLLAPSE).
189 */189 */
190# define PR_THP_DISABLE_EXCEPT_ADVISED (1 << 1)190# define PR_THP_DISABLE_EXCEPT_ADVISED (1 << 1)
191#define PR_GET_THP_DISABLE 42191#define PR_GET_THP_DISABLE 42

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t