large folios swap-in: handle refault cases first
Status from this message: [merged mm-stable] mm-swap-entirely-map-large-folios-found-in-swapcache.patch removed from -mm tree
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v5 Latest6 patches 0 repliesApplied 6/6
- v46 patches 4 repliesSuperseded
- v36 patches 42 repliesSuperseded
Earlier versions · 2
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v2 | 5 patches | 48 replies | Superseded | |
| v1 | 4 patches | 4 replies | Superseded |
Patches in v5 All 6 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/6 | mm: swap: introduce swap_free_nr() for batched swap_free()include/ mm/ | +52 | 0 replies | Applied |
| 2/6 | mm: remove the implementation of swap_free() and always use swap_free_nr()include/ kernel/ mm/ | +11 | 0 replies | Applied |
| 3/6 | mm: introduce pte_move_swp_offset() helper which can move offset bidirectionallymm/ | +21 | 0 replies | Applied |
| 4/6 | mm: introduce arch_do_swap_page_nr() which allows restore metadata for nr pagesinclude/ mm/ | +22 | 0 replies | Applied |
| 5/6 | mm: swap: make should_try_to_free_swap() support large-foliomm/ | +1 | 0 replies | Applied |
| 6/6 | mm: swap: entirely map large folios found in swapcachemm/ | +48 | 0 replies | Applied |
Reviews trailers per patch
All 6 patches have a Reviewed-by or Acked-by.
| Patch | Ryan Roberts | Chris Li | Huang, Ying | Khalid Aziz | David Hildenbrand |
|---|---|---|---|---|---|
| 1/6 | R-b | A-b | R-b | ||
| 2/6 | R-b | A-b | R-b | ||
| 3/6 | R-b | R-b | |||
| 4/6 | R-b | R-b | |||
| 5/6 | R-b | A-b | R-b | R-b | |
| 6/6 | R-b | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 5 reviewers.
Cover letter [PATCH v5 0/6] large folios swap-in: handle refault cases first
From: Barry Song <[email protected]>
This patch is extracted from the large folio swapin series[1], primarily addressing the handling of scenarios involving large folios in the swap cache. Currently, it is particularly focused on addressing the refaulting of mTHP, which is still undergoing reclamation. This approach aims to streamline code review and expedite the integration of this segment into the MM tree.
It relies on Ryan's swap-out series[2], leveraging the helper function swap_pte_batch() introduced by that series.
Presently, do_swap_page only encounters a large folio in the swap cache before the large folio is released by vmscan. However, the code should remain equally useful once we support large folio swap-in via swapin_readahead(). This approach can effectively reduce page faults and eliminate most redundant checks and early exits for MTE restoration in recent MTE patchset[3].
The large folio swap-in for SWP_SYNCHRONOUS_IO and swapin_readahead() will be split into separate patch sets and sent at a later time.
-v5:
collect reviewed-by of Ryan, "Huang, Ying", thanks!
-v4:
- collect acked-by/reviewed-by of Ryan, "Huang, Ying", Chris, David and Khalid, many thanks!
- Simplify reuse code in do_swap_page() by checking refcount==1, per David;
- Initialize large folio-related variables later in do_swap_page(), per Ryan;
- define swap_free() as swap_free_nr(1) per Ying and Ryan.
-v3:
- optimize swap_free_nr using bitmap with single one "long"; "Huang, Ying"
- drop swap_free() as suggested by "Huang, Ying", now hibernation can get batched;
- lots of cleanup in do_swap_page() as commented by Ryan Roberts and "Huang, Ying";
- handle arch_do_swap_page() with nr pages though the only platform which needs it, sparc, doesn't support THP_SWAPOUT as suggested by "Huang, Ying";
- introduce pte_move_swp_offset() as suggested by "Huang, Ying";
- drop the "any_shared" of checking swap entries with respect to David's comment;
- drop the counter of swapin_refault and keep it for debug purpose per Ying
- collect reviewed-by tags
Link:
https://lore.kernel.org/linux-mm/[email protected]/
-v2:
- rebase on top of mm-unstable in which Ryan's swap_pte_batch() has changed a lot.
- remove folio_add_new_anon_rmap() for !folio_test_anon()
as currently large folios are always anon(refault).
- add mTHP swpin refault counters
Link:
https://lore.kernel.org/linux-mm/[email protected]/
-v1:
Differences with the original large folios swap-in series
- collect r-o-b, acked;
- rename swap_nr_free to swap_free_nr, according to Ryan;
- limit the maximum kernel stack usage for swap_free_nr, Ryan;
- add output argument in swap_pte_batch to expose if all entries are exclusive
- many clean refinements, handle the corner case folio's virtual addr might not be naturally aligned
[1] https://lore.kernel.org/linux-mm/[email protected]/
[2] https://lore.kernel.org/linux-mm/[email protected]/
[3] https://lore.kernel.org/linux-mm/[email protected]/
Barry Song (3):
mm: remove the implementation of swap_free() and always use
swap_free_nr()
mm: introduce pte_move_swp_offset() helper which can move offset
bidirectionally
mm: introduce arch_do_swap_page_nr() which allows restore metadata for
nr pages
Chuanhua Han (3):
mm: swap: introduce swap_free_nr() for batched swap_free()
mm: swap: make should_try_to_free_swap() support large-folio
mm: swap: entirely map large folios found in swapcache
include/linux/pgtable.h | 26 +++++++++++++----- include/linux/swap.h | 9 +++++-- kernel/power/swap.c | 5 ++-- mm/internal.h | 25 ++++++++++++++--- mm/memory.c | 60 +++++++++++++++++++++++++++++++++-------- mm/swapfile.c | 48 +++++++++++++++++++++++++++++---- 6 files changed, 142 insertions(+), 31 deletions(-)
Signature · 1 line
2.34.1