mm,thp,shm: limit shmem THP alloc gfp_mask
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v6 Latest3 patches 20 repliesIn review 2 of 3 applied
- v41 patch 2 repliesSuperseded
- v31 patch 1 replySuperseded
Earlier versions · 2
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v2 | 1 patch | 5 replies | Superseded | |
| v1 | 1 patch | 9 replies | Superseded |
Patches in v6 2 of 3 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | mm,thp,shmem: limit shmem THP alloc gfp_maskinclude/ mm/ mm/ | +10 | 2 replies | |
| 2/3 | mm,thp,shm: limit gfp mask to no more than specifiedmm/ | +21 | 6 replies | Applied |
| 3/3 | mm,thp,shmem: make khugepaged obey tmpfs mount flagsinclude/ mm/ | +18 | 4 replies | Applied |
Reviews trailers per patch
1 of 3 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Vlastimil Babka | Michal Hocko |
|---|---|---|
| Series | A-b | |
| 1/3 | A-b | A-b |
| 2/3 | ||
| 3/3 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v6 0/3] mm,thp,shm: limit shmem THP alloc gfp_mask
The allocation flags of anonymous transparent huge pages can be controlled through the files in /sys/kernel/mm/transparent_hugepage/defrag, which can help the system from getting bogged down in the page reclaim and compaction code when many THPs are getting allocated simultaneously.
However, the gfp_mask for shmem THP allocations were not limited by those configuration settings, and some workloads ended up with all CPUs stuck on the LRU lock in the page reclaim code, trying to allocate dozens of THPs simultaneously.
This patch applies the same configurated limitation of THPs to shmem hugepage allocations, to prevent that from happening.
This way a THP defrag setting of "never" or "defer+madvise" will result in quick allocation failures without direct reclaim when no 2MB free pages are available.
With this patch applied, THP allocations for tmpfs will be a little more aggressive than today for files mmapped with MADV_HUGEPAGE, and a little less aggressive for files that are not mmapped or mapped without that flag.
v6: make khugepaged actually obey tmpfs mount flags
v5: reduce gfp mask further if needed, to accomodate i915 (Matthew Wilcox)
v4: rename alloc_hugepage_direct_gfpmask to vma_thp_gfp_mask (Matthew Wilcox)
v3: fix NULL vma issue spotted by Hugh Dickins & tested
v2: move gfp calculation to shmem_getpage_gfp as suggested by Yu Xu