[tip: perf/core] mm/gup: Use raw_seqcount_try_begin()
From: tip-bot2 for Peter Zijlstra
Date: Mon Dec 02 2024 - 06:16:33 EST
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 7528585290a1a1d4e0fb4b72261eb2d8c85de2d7
Gitweb: https://git.kernel.org/tip/7528585290a1a1d4e0fb4b72261eb2d8c85de2d7
Author: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
AuthorDate: Fri, 22 Nov 2024 12:47:48 +01:00
Committer: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
CommitterDate: Mon, 02 Dec 2024 12:01:37 +01:00
mm/gup: Use raw_seqcount_try_begin()
David pointed out that gup_fast() does exactly what the new
raw_seqcount_try_begin() does -- use it.
Suggested-by: David Hildenbrand <david@xxxxxxxxxx>
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Reviewed-by: David Hildenbrand <david@xxxxxxxxxx>
---
mm/gup.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/mm/gup.c b/mm/gup.c
index 746070a..81ffbd8 100644
--- 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(¤t->mm->write_protect_seq);
- if (seq & 1)
+ if (!raw_seqcount_try_begin(¤t->mm->write_protect_seq, seq))
return 0;
}