[SERVER-20791] Disable THP via MADV_NOHUGEPAGE Created: 07/Oct/15  Updated: 06/Feb/24

Status: Backlog
Project: Core Server
Component/s: Storage
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Achille Brighton Assignee: Backlog - Service Architecture
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-86263 Verify that prctrl will work to selec... Closed
Assigned Teams:
Service Arch
Participants:

 Description   

Calling madvise() with MADV_NOHUGEPAGE (added in Linux 2.6.38) would allow MongoDB to effectively mark regions unsuited for transparent hugepages. On 3.15 kernels and above we can use PR_SET_THP_DISABLE to disable THP process-wide.

This approach should be more effective than simply instructing users to disable THP via warnings.



 Comments   
Comment by Jeremy Eder [ 07/Oct/16 ]

Being able to selectively disable THP on a per application basis becomes much more important in systems that may run different types of workloads (such as container platforms), where globally disabling THP may adversely affect other workloads.

There are two ways:
madvise(MADV_DONTNEED)

or wrapper-capable:
prctl(PR_SET_THP_DISABLE) prctl(PR_GET_THP_DISABLE)

Generated at Thu Feb 08 03:55:17 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.