mm/gup: Use raw_seqcount_try_begin()
authorPeter Zijlstra <peterz@infradead.org>
Fri, 22 Nov 2024 11:47:48 +0000 (12:47 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Mon, 2 Dec 2024 11:01:37 +0000 (12:01 +0100)
David pointed out that gup_fast() does exactly what the new
raw_seqcount_try_begin() does -- use it.

Suggested-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: David Hildenbrand <david@redhat.com>
mm/gup.c

index 746070a1d8bfbb89dc06e632a116c67acc57a946..81ffbd8fec9c7d482fe401d120ba2f023b3ab40f 100644 (file)
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -3351,8 +3351,7 @@ static unsigned long gup_fast(unsigned long start, unsigned long end,
                return 0;
 
        if (gup_flags & FOLL_PIN) {
-               seq = raw_read_seqcount(&current->mm->write_protect_seq);
-               if (seq & 1)
+               if (!raw_seqcount_try_begin(&current->mm->write_protect_seq, seq))
                        return 0;
        }