Module Name: src Committed By: riastradh Date: Sat Apr 9 23:44:25 UTC 2022
Modified Files: src/sys/external/bsd/drm2/include/linux: ratelimit.h Log Message: 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...!) To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/include/linux/ratelimit.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/external/bsd/drm2/include/linux/ratelimit.h diff -u src/sys/external/bsd/drm2/include/linux/ratelimit.h:1.5 src/sys/external/bsd/drm2/include/linux/ratelimit.h:1.6 --- src/sys/external/bsd/drm2/include/linux/ratelimit.h:1.5 Sun Dec 19 11:36:57 2021 +++ src/sys/external/bsd/drm2/include/linux/ratelimit.h Sat Apr 9 23:44:25 2022 @@ -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);