Add a seqcount between gup_fast and copy_page_range()
Status from this message: [merged] mm-reorganize-internal_get_user_pages_fast.patch removed from -mm tree
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v4 Latest2 patches 4 repliesApplied 2/2
- v32 patches 3 repliesSuperseded
- v22 patches 29 repliesApplied
Earlier versions · 1
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v1 | 2 patches | 16 replies | Superseded |
Changes in v4 from the cover letter
- Use read_seqcount_retry() not read_seqcount_t_retry
v3: https://lore.kernel.org/r/[email protected]
- Revise comment for write_protect_seq
- Revise comment in copy_page_range
- Use raw_write_seqcount_begin() not raw_write_seqcount_t_begin()
v2: https://lore.kernel.org/r/[email protected]
- Use start not addr in lockless_pages_from_mm
- Replace unsigned long casts with using the proper variable type
- Update comments
- Use raw_write_seqcount_t_begin() instead of open coding
- Update commit messages
v1: https://lore.kernel.org/r/[email protected]
Patches in v4 All 2 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | mm: reorganize internal_get_user_pages_fast()mm/ | +54 | 0 replies | Applied |
| 2/2 | mm: prevent gup_fast from racing with COW during forkarch/ drivers/ include/ +4 more | +42 | 3 replies | Applied |
Reviews trailers per patch
All 2 patches have a Reviewed-by or Acked-by.
| Patch | Jan Kara | John Hubbard | Peter Xu | Ahmed S. Darwish |
|---|---|---|---|---|
| 1/2 | R-b | R-b | R-b | |
| 2/2 | R-b | R-b | R-b | A-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 4 reviewers.
Cover letter [PATCH v4 0/2] Add a seqcount between gup_fast and copy_page_range()
As discussed and suggested by Linus use a seqcount to close the small race between gup_fast and copy_page_range().
Ahmed confirms that raw_write_seqcount_begin() is the correct API to use in this case and it doesn't trigger any lockdeps.
I was able to test it using two threads, one forking and the other using ibv_reg_mr() to trigger GUP fast. Modifying copy_page_range() to sleep made the window large enough to reliably hit to test the logic.
v4:
- Use read_seqcount_retry() not read_seqcount_t_retry
v3: https://lore.kernel.org/r/[email protected]
- Revise comment for write_protect_seq
- Revise comment in copy_page_range
- Use raw_write_seqcount_begin() not raw_write_seqcount_t_begin()
v2: https://lore.kernel.org/r/[email protected]
- Use start not addr in lockless_pages_from_mm
- Replace unsigned long casts with using the proper variable type
- Update comments
- Use raw_write_seqcount_t_begin() instead of open coding
- Update commit messages
v1: https://lore.kernel.org/r/[email protected]
To: [email protected]
To: Peter Xu <[email protected]>
To: Linus Torvalds <[email protected]>
Cc: Peter Xu <[email protected]>
Cc: John Hubbard <[email protected]>
Cc: Linux-MM <[email protected]>
Cc: Linux Kernel Mailing List <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Jan Kara <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Kirill Tkhai <[email protected]>
Cc: Kirill Shutemov <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Cc: Andrea Arcangeli <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Cc: Jann Horn <[email protected]>
Cc: "Ahmed S. Darwish" <[email protected]>
Jason Gunthorpe (2):
mm: reorganize internal_get_user_pages_fast()
mm: prevent gup_fast from racing with COW during fork
arch/x86/kernel/tboot.c | 1 + drivers/firmware/efi/efi.c | 1 + include/linux/mm_types.h | 8 +++ kernel/fork.c | 1 + mm/gup.c | 117 +++++++++++++++++++++++-------------- mm/init-mm.c | 1 + mm/memory.c | 13 ++++- 7 files changed, 96 insertions(+), 46 deletions(-)
Signature · 1 line
2.29.2