diff options
| author | riastradh <riastradh@NetBSD.org> | 2022-04-09 23:44:25 +0000 |
|---|---|---|
| committer | riastradh <riastradh@NetBSD.org> | 2022-04-09 23:44:25 +0000 |
| commit | 03dd4f2e5ebd0a786fa4051069bd7361df790fdb (patch) | |
| tree | 20839624b173b07b2d975b38ce231a5001e48d31 /sys/external/bsd/drm2/include | |
| parent | 759280f383ea5f80515b30532a674970fa277422 (diff) | |
linux/ratelimit: Convert to membar_acquire and atomic_store_release.
Simplify while here: atomic_swap is enough, no need for atomic_cas.
(Maybe drm'll run faster on sparcv8 this way...!)
Diffstat (limited to 'sys/external/bsd/drm2/include')
| -rw-r--r-- | sys/external/bsd/drm2/include/linux/ratelimit.h | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/external/bsd/drm2/include/linux/ratelimit.h b/sys/external/bsd/drm2/include/linux/ratelimit.h index 4628f71ec47..dbf830cfed6 100644 --- a/sys/external/bsd/drm2/include/linux/ratelimit.h +++ b/sys/external/bsd/drm2/include/linux/ratelimit.h @@ -1,4 +1,4 @@ -/* $NetBSD: ratelimit.h,v 1.5 2021/12/19 11:36:57 riastradh Exp $ */ +/* $NetBSD: ratelimit.h,v 1.6 2022/04/09 23:44:25 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -86,14 +86,13 @@ __ratelimit(struct ratelimit_state *r) { int ok; - if (atomic_cas_uint(&r->rl_lock, 0, 1)) { + if (atomic_swap_uint(&r->rl_lock, 1)) { ok = false; goto out; } - membar_enter(); + membar_acquire(); ok = ppsratecheck(&r->rl_lasttime, &r->rl_curpps, r->rl_maxpps); - membar_exit(); - r->rl_lock = 0; + atomic_store_release(&r->rl_lock, 0); out: if (!ok) atomic_store_relaxed(&r->missed, 1); |
