mm: don't allocate page tables with the folio locked
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest4 patches 5 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/4 | mm/khugepaged: allocate page tables before locking the foliomm/ | +56 | 0 replies | |
| 2/4 | mm/memory: don't allocate in finish_fault() with the folio lockedmm/ | +9 | 0 replies | |
| 3/4 | mm/memory: never allocate a page table in do_set_pmd()include/ mm/ mm/ +1 more | +10 | 0 replies | |
| 4/4 | mm/khugepaged: use NOFS while collapse_file() holds folio locksmm/ | +11 | 5 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/4] mm: don't allocate page tables with the folio locked
David asked for the remaining places that allocate with __GFP_FS while holding a folio lock [1]. The fault path and khugepaged still allocate page tables that way, and collapse_file() calls filemap_release_folio() and swaps in shmem folios with folio locks held.
Patch 1 allocates the page tables khugepaged needs before locking the folio.
Patch 2 makes finish_fault() retry the fault instead of allocating when the page table went away after __do_fault() checked the PMD. Patch 3 drops the allocation from do_set_pmd(), no caller needs it anymore. Patch 4 runs the part of collapse_file() that holds folio locks in a NOFS scope, like __folio_split().
I don't have a real deadlock for patch 4, it just does what [2] does for splitting, so I left it without a stable tag.
Based on mm/core.git for-next, patch 3 needs the do_set_pmd() changes there.
Tested on x86_64 and on ppc64le with the hash MMU in QEMU.
[1] https://lore.kernel.org/[email protected]
[2] https://lore.kernel.org/[email protected]
Jose A. Perez de Azpillaga (4):
mm/khugepaged: allocate page tables before locking the folio mm/memory: don't allocate in finish_fault() with the folio locked mm/memory: never allocate a page table in do_set_pmd() mm/khugepaged: use NOFS while collapse_file() holds folio locks
include/linux/mm.h | 3 +- mm/filemap.c | 2 +- mm/khugepaged.c | 91 ++++++++++++++++++++++++++++++++++------------ mm/memory.c | 39 ++++++++------------ 4 files changed, 85 insertions(+), 50 deletions(-)
base-commit: 98f6b507621822477db7ec7cef8519de0dd243c4
Signature · 1 line
2.56.1