linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] mm: Break COW for pinned pages during fork()
@ 2020-09-25 22:25 Peter Xu
  2020-09-25 22:25 ` [PATCH v2 1/4] mm: Introduce mm_struct.has_pinned Peter Xu
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Peter Xu @ 2020-09-25 22:25 UTC (permalink / raw)
  To: linux-kernel, linux-mm
  Cc: peterx, Jason Gunthorpe, John Hubbard, Andrew Morton,
	Christoph Hellwig, Yang Shi, Oleg Nesterov, Kirill Tkhai,
	Kirill Shutemov, Hugh Dickins, Jann Horn, Linus Torvalds,
	Michal Hocko, Jan Kara, Andrea Arcangeli, Leon Romanovsky

Due to the rebase to latest rc6, the major pte copy patch changed a lot.  So
maybe not that useful to write a changelog any more.  However all the comments
should be addressed as long as discussed in previous thread.  Please shoot if I
missed anything important.

This series is majorly inspired by the previous discussion on the list [1],
starting from the report from Jason on the rdma test failure.  Linus proposed
the solution, which seems to be a very nice approach to avoid the breakage of
userspace apps that didn't use MADV_DONTFORK properly before.  More information
can be found in that thread too.

I tested it myself with fork() after vfio pinning a bunch of device pages, and
I verified that the new copy pte logic worked as expected at least in the most
general path.  However I didn't test thp case yet because afaict vfio does not
support thp backed dma pages.  Luckily, the pmd/pud thp patch is much more
straightforward than the pte one, so hopefully it can be directly verified by
some code review plus some more heavy-weight rdma tests.

Patch 1:      Introduce mm.has_pinned
Patch 2:      Preparation patch
Patch 3:      Early cow solution for pte copy for pinned pages
Patch 4:      Same as above, but for thp (pmd/pud).

Hugetlbfs fix is still missing, but as planned, that's not urgent so we can
work upon.  Comments greatly welcomed.

[1] https://lore.kernel.org/lkml/20200914143829.GA1424636@nvidia.com/

Thanks.

Peter Xu (4):
  mm: Introduce mm_struct.has_pinned
  mm/fork: Pass new vma pointer into copy_page_range()
  mm: Do early cow for pinned pages during fork() for ptes
  mm/thp: Split huge pmds/puds if they're pinned when fork()

 include/linux/mm.h       |   2 +-
 include/linux/mm_types.h |  10 +++
 kernel/fork.c            |   3 +-
 mm/gup.c                 |   6 ++
 mm/huge_memory.c         |  28 ++++++
 mm/memory.c              | 186 ++++++++++++++++++++++++++++++++++-----
 6 files changed, 212 insertions(+), 23 deletions(-)

-- 
2.26.2




^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-09-30 17:05 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-25 22:25 [PATCH v2 0/4] mm: Break COW for pinned pages during fork() Peter Xu
2020-09-25 22:25 ` [PATCH v2 1/4] mm: Introduce mm_struct.has_pinned Peter Xu
2020-09-25 22:25 ` [PATCH v2 2/4] mm/fork: Pass new vma pointer into copy_page_range() Peter Xu
2020-09-30 13:30   ` Kirill A. Shutemov
2020-09-30 17:05     ` Peter Xu
2020-09-25 22:25 ` [PATCH v2 3/4] mm: Do early cow for pinned pages during fork() for ptes Peter Xu
2020-09-26 23:23   ` Jason Gunthorpe
2020-09-27  0:04     ` Linus Torvalds
2020-09-27  4:09       ` Peter Xu
2020-09-25 22:26 ` [PATCH v2 4/4] mm/thp: Split huge pmds/puds if they're pinned when fork() Peter Xu
2020-09-27 19:35 ` [PATCH v2 0/4] mm: Break COW for pinned pages during fork() Linus Torvalds
2020-09-29 11:02   ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).