Re: [PATCH v4 0/2] Add a seqcount between gup_fast and copy_page_range()

From: Linus Torvalds
Date: Wed Nov 11 2020 - 13:27:57 EST


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