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 Use Linux atomic64 for ww mutex class.
details: https://anonhg.NetBSD.org/src/rev/594d7a32db35
branches: trunk
changeset: 835468:594d7a32db35
user: riastradh <riastradh%NetBSD.org@localhost>
date: Mon Aug 27 15:11:32 2018 +0000
description:
Use Linux atomic64 for ww mutex class.
This way we can take advantage of the hash-locked atomic64 on
platforms that lack native atomic_inc_64_nv.
diffstat:
sys/external/bsd/drm2/include/linux/ww_mutex.h | 7 ++++---
sys/external/bsd/drm2/linux/linux_ww_mutex.c | 6 +++---
2 files changed, 7 insertions(+), 6 deletions(-)
diffs (55 lines):
diff -r a9f0d5586a27 -r 594d7a32db35 sys/external/bsd/drm2/include/linux/ww_mutex.h
--- a/sys/external/bsd/drm2/include/linux/ww_mutex.h Mon Aug 27 15:11:17 2018 +0000
+++ b/sys/external/bsd/drm2/include/linux/ww_mutex.h Mon Aug 27 15:11:32 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ww_mutex.h,v 1.12 2018/08/27 06:06:41 riastradh Exp $ */
+/* $NetBSD: ww_mutex.h,v 1.13 2018/08/27 15:11:32 riastradh Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -37,15 +37,16 @@
#include <sys/mutex.h>
#include <sys/rbtree.h>
+#include <linux/atomic.h>
#include <linux/mutex.h>
struct ww_class {
- volatile uint64_t wwc_ticket;
+ atomic64_t wwc_ticket;
};
#define DEFINE_WW_CLASS(CLASS) \
struct ww_class CLASS = { \
- .wwc_ticket = 0, \
+ .wwc_ticket = ATOMIC64_INIT(0), \
}
struct ww_acquire_ctx {
diff -r a9f0d5586a27 -r 594d7a32db35 sys/external/bsd/drm2/linux/linux_ww_mutex.c
--- a/sys/external/bsd/drm2/linux/linux_ww_mutex.c Mon Aug 27 15:11:17 2018 +0000
+++ b/sys/external/bsd/drm2/linux/linux_ww_mutex.c Mon Aug 27 15:11:32 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_ww_mutex.c,v 1.4 2017/09/16 23:56:42 christos Exp $ */
+/* $NetBSD: linux_ww_mutex.c,v 1.5 2018/08/27 15:11:32 riastradh Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_ww_mutex.c,v 1.4 2017/09/16 23:56:42 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_ww_mutex.c,v 1.5 2018/08/27 15:11:32 riastradh Exp $");
#include <sys/types.h>
#include <sys/atomic.h>
@@ -92,7 +92,7 @@
ctx->wwx_class = class;
ctx->wwx_owner = curlwp;
- ctx->wwx_ticket = atomic_inc_64_nv(&class->wwc_ticket);
+ ctx->wwx_ticket = atomic64_inc_return(&class->wwc_ticket);
ctx->wwx_acquired = 0;
ctx->wwx_acquire_done = false;
}
Home |
Main Index |
Thread Index |
Old Index