On Tue, Nov 10, 2020 at 3:44 PM Jason Gunthorpe <jgg@xxxxxxxxxx> wrote: > > 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. Looks all good to me. Linus