On Mon, Feb 08, 2021 at 10:02:29PM -0500, Peter Xu wrote: > This is the last missing piece of the COW-during-fork effort when there're > pinned pages found. One can reference 70e806e4e645 ("mm: Do early cow for > pinned pages during fork() for ptes", 2020-09-27) for more information, since > we do similar things here rather than pte this time, but just for hugetlb. > > Note that after Jason's recent work on 57efa1fe5957 ("mm/gup: prevent gup_fast > from racing with COW during fork", 2020-12-15) which is safer and easier to > understand, we're safe now within the whole copy_page_range() against gup-fast, > we don't need the wr-protect trick that proposed in 70e806e4e645 anymore. > > Reviewed-by: Mike Kravetz <mike.kravetz@xxxxxxxxxx> > Signed-off-by: Peter Xu <peterx@xxxxxxxxxx> > --- > mm/hugetlb.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++---- > 1 file changed, 62 insertions(+), 4 deletions(-) Didn't check every hugetlbfs detail, but looks reasonable Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx> Jason