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.
Showing the changes to include/uapi (1 of 5 files). Show all
Unified · Split
| @@ -185,7 +185,7 @@ struct prctl_mm_map { · 184 unmodified lines | ||
| 185 | 185 | #define PR_SET_THP_DISABLE 41 |
| 186 | 186 | /* |
| 187 | 187 | * Don't disable THPs when explicitly advised (e.g., MADV_HUGEPAGE / |
| 188 | − * VM_HUGEPAGE). | |
| 188 | + * VM_HUGEPAGE, MADV_COLLAPSE). | |
| 189 | 189 | */ |
| 190 | 190 | # define PR_THP_DISABLE_EXCEPT_ADVISED (1 << 1) |
| 191 | 191 | #define PR_GET_THP_DISABLE 42 |