Thread (44 messages) 44 messages, 7 authors, 2019-04-12

Re: [PATCH-tip 04/22] locking/rwsem: Remove arch specific rwsem files

From: Peter Zijlstra <peterz@infradead.org>
Date: 2019-02-07 19:37:18
Also in: linux-alpha, linux-arch, linux-sh, linuxppc-dev, lkml, sparclinux

On Thu, Feb 07, 2019 at 02:07:08PM -0500, Waiman Long wrote:
+static inline int __down_read_trylock(struct rw_semaphore *sem)
+{
+	long tmp;
+
+	while ((tmp = atomic_long_read(&sem->count)) >= 0) {
+		if (tmp == atomic_long_cmpxchg_acquire(&sem->count, tmp,
+				   tmp + RWSEM_ACTIVE_READ_BIAS)) {
+			return 1;
+		}
+	}
Nah, you're supposed to write that like:

	for (;;) {
		val = atomic_long_cond_read_relaxed(&sem->count, VAL < 0);
		if (atomic_long_try_cmpxchg_acquire(&sem->count, &val,
						    val + RWSEM_ACTIVE_READ_BIAS))
			break;
	}
+	return 0;
+}

Anyway, yuck, you're keeping all that BIAS nonsense :/ I was so hoping
for a rwsem implementation without that impenetrable crap.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help