mm/khugepaged: collapse_file() cleanups
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest8 patches 0 repliesNew
- v18 patches 12 repliesSuperseded
Changes in v2 from the cover letter · 17 lines
- Rebased on current mm-core/for-next, which contains a number of fixes to the amazingly simple and awesome collapse_file() function.
- Fix the "bad unlock balance" reported by syzbot ci (syzbot ci, Lorenzo)
- 1/8:
- Fold in v1 5/8 (kerneldoc); new helpers get their kerneldoc in the patch that introduces them. (Lorenzo)
- Group the input fields of collapse_file_state and make end and is_shmem const; is_shmem is now a bool. (Lorenzo)
- Wrap the prepare_collapse_file_folio() declaration to fit in 80 columns. (Lorenzo)
- Keep the original LRU drain behaviour (drain only after a successful shmem_get_folio()) (Lorenzo)
- 2/8: New patch. Turn value entries into NULL before calling prepare_collapse_file_folio().
- 3/8 (v1 2/8):
- Rename collapse_read_folio() to maybe_read_folio(). (Lorenzo)
- Replace the compound condition with an early-return guard. (Lorenzo)
- Comment on why the xa_lock is dropped. (Lorenzo)
- Expand the commit message. (Lorenzo)
- 5/8 (v1 4/8): Drop a duplicate blank line.
- 6/8: Add a commit message, noting that errors before try_to_unmap() no longer call try_to_unmap_flush() themselves.
- 7/8: Explain in the commit message why the refcount and dirty checks don't need the i_pages lock. The flush added by 854e5ff8b3ce now happens at out_putback.
- 8/8: Retitle (drop "fix"), since 854e5ff8b3ce already reworded the comment; drop a stray blank line.
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/8 | mm/khugepaged: separate out windy folio logic from collapse_filemm/ | +128 | 0 replies | |
| 2/8 | mm/khugepaged: sanitize the folio passed to file folio collapse logicmm/ | +21 | 0 replies | |
| 3/8 | mm/khugepaged: factor out page cache folio readingmm/ | +59 | 0 replies | |
| 4/8 | mm/khugepaged: factor out and simplify dirty/writeback handlingmm/ | +24 | 0 replies | |
| 5/8 | mm/khugepaged: simplify prepare folio locking and exit pathsmm/ | +11 | 0 replies | |
| 6/8 | mm/khugepaged: hoist isolation into collapse_isolate_folio()mm/ | +66 | 0 replies | |
| 7/8 | mm/khugepaged: hoist more code into collapse_isolate_folio()mm/ | +42 | 0 replies | |
| 8/8 | mm/khugepaged: flesh out try_to_unmap_flush() commentmm/ | +6 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.
Cover letter [PATCH v2 0/8] mm/khugepaged: collapse_file() cleanups
Here are a bunch of cleanups for collapse_file() that attempt to aid code readability and understanding. This is part 1 out of N, and only attempts to address the main collapse loop. The exit path is still a mess but I figure it's much easier to review if I send this batch as-is, versus sending the whole thing.
Tested using the khugepaged shmem and file selftests.
Based on top of latest mm-core/for-next.
Note that some review comments from v1 went unaddressed (Nico's larger restructuring, some small Lorenzo suggestions) for a couple of small reasons. The main one being that I want to get this v2 out before going insane :)) I agreed to work with Nico, and I'll either send out some of his patches as a followup, or he will.
In any case, I'm tired of this function and I hope this kicks off some discussion :)
Changes in v2:
- Rebased on current mm-core/for-next, which contains a number of fixes to the amazingly simple and awesome collapse_file() function.
- Fix the "bad unlock balance" reported by syzbot ci (syzbot ci, Lorenzo)
- 1/8:
- Fold in v1 5/8 (kerneldoc); new helpers get their kerneldoc in the patch that introduces them. (Lorenzo)
- Group the input fields of collapse_file_state and make end and is_shmem const; is_shmem is now a bool. (Lorenzo)
- Wrap the prepare_collapse_file_folio() declaration to fit in 80 columns. (Lorenzo)
- Keep the original LRU drain behaviour (drain only after a successful shmem_get_folio()) (Lorenzo)
- 2/8: New patch. Turn value entries into NULL before calling prepare_collapse_file_folio().
- 3/8 (v1 2/8):
- Rename collapse_read_folio() to maybe_read_folio(). (Lorenzo)
- Replace the compound condition with an early-return guard. (Lorenzo)
- Comment on why the xa_lock is dropped. (Lorenzo)
- Expand the commit message. (Lorenzo)
- 5/8 (v1 4/8): Drop a duplicate blank line.
- 6/8: Add a commit message, noting that errors before try_to_unmap() no longer call try_to_unmap_flush() themselves.
- 7/8: Explain in the commit message why the refcount and dirty checks don't need the i_pages lock. The flush added by 854e5ff8b3ce now happens at out_putback.
- 8/8: Retitle (drop "fix"), since 854e5ff8b3ce already reworded the comment; drop a stray blank line.
Link to v1: https://lore.kernel.org/all/[email protected]/
Pedro Falcato (8):
mm/khugepaged: separate out windy folio logic from collapse_file mm/khugepaged: sanitize the folio passed to file folio collapse logic mm/khugepaged: factor out page cache folio reading mm/khugepaged: factor out and simplify dirty/writeback handling mm/khugepaged: simplify prepare folio locking and exit paths mm/khugepaged: hoist isolation into collapse_isolate_folio() mm/khugepaged: hoist more code into collapse_isolate_folio() mm/khugepaged: flesh out try_to_unmap_flush() comment
mm/khugepaged.c | 461 ++++++++++++++++++++++++++++++------------------ 1 file changed, 286 insertions(+), 175 deletions(-)
base-commit: 8d21e3d3faf19f461f6d0380fe8a1f5bdba97f25
Signature · 1 line
2.56.0