Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/include/linux linux/ratelimit: Convert...



details:   https://anonhg.NetBSD.org/src/rev/4c5aab528985
branches:  trunk
changeset: 365161:4c5aab528985
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Apr 09 23:44:25 2022 +0000

description:
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:

 sys/external/bsd/drm2/include/linux/ratelimit.h |  9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diffs (27 lines):

diff -r 8d62ea301042 -r 4c5aab528985 sys/external/bsd/drm2/include/linux/ratelimit.h
--- a/sys/external/bsd/drm2/include/linux/ratelimit.h   Sat Apr 09 23:43:55 2022 +0000
+++ b/sys/external/bsd/drm2/include/linux/ratelimit.h   Sat Apr 09 23:44:25 2022 +0000
@@ -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 @@
 {
        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);



Home | Main Index | Thread Index | Old Index