Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Jul 2019 01:19:28 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r349757 - stable/12/sys/kern
Message-ID:  <201907050119.x651JSJX006825@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Fri Jul  5 01:19:28 2019
New Revision: 349757
URL: https://svnweb.freebsd.org/changeset/base/349757

Log:
  MFC r349611, r349614:
  Style.

Modified:
  stable/12/sys/kern/kern_umtx.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/kern_umtx.c
==============================================================================
--- stable/12/sys/kern/kern_umtx.c	Fri Jul  5 01:04:58 2019	(r349756)
+++ stable/12/sys/kern/kern_umtx.c	Fri Jul  5 01:19:28 2019	(r349757)
@@ -1059,7 +1059,6 @@ do_lock_normal(struct thread *td, struct umutex *m, ui
 			if (owner == UMUTEX_RB_NOTRECOV)
 				return (ENOTRECOVERABLE);
 
-
 			/*
 			 * Try the uncontested case.  This should be
 			 * done in userland.
@@ -2658,7 +2657,8 @@ do_rw_rdlock(struct thread *td, struct urwlock *rwlock
 
 		/* try to lock it */
 		while (!(state & wrflags)) {
-			if (__predict_false(URWLOCK_READER_COUNT(state) == URWLOCK_MAX_READERS)) {
+			if (__predict_false(URWLOCK_READER_COUNT(state) ==
+			    URWLOCK_MAX_READERS)) {
 				umtx_key_release(&uq->uq_key);
 				return (EAGAIN);
 			}
@@ -2725,7 +2725,10 @@ do_rw_rdlock(struct thread *td, struct urwlock *rwlock
 		}
 
 sleep:
-		/* contention bit is set, before sleeping, increase read waiter count */
+		/*
+		 * Contention bit is set, before sleeping, increase
+		 * read waiter count.
+		 */
 		rv = fueword32(&rwlock->rw_blocked_readers,
 		    &blocked_readers);
 		if (rv == -1) {
@@ -2829,7 +2832,8 @@ do_rw_wrlock(struct thread *td, struct urwlock *rwlock
 			umtx_key_release(&uq->uq_key);
 			return (EFAULT);
 		}
-		while (!(state & URWLOCK_WRITE_OWNER) && URWLOCK_READER_COUNT(state) == 0) {
+		while ((state & URWLOCK_WRITE_OWNER) == 0 &&
+		    URWLOCK_READER_COUNT(state) == 0) {
 			rv = casueword32(&rwlock->rw_state, state,
 			    &oldstate, state | URWLOCK_WRITE_OWNER);
 			if (rv == -1) {
@@ -2865,8 +2869,8 @@ do_rw_wrlock(struct thread *td, struct urwlock *rwlock
 		umtxq_unlock(&uq->uq_key);
 
 		/*
-		 * re-read the state, in case it changed between the try-lock above
-		 * and the check below
+		 * Re-read the state, in case it changed between the
+		 * try-lock above and the check below.
 		 */
 		rv = fueword32(&rwlock->rw_state, &state);
 		if (rv == -1)
@@ -2893,7 +2897,8 @@ do_rw_wrlock(struct thread *td, struct urwlock *rwlock
 			break;
 		}
 
-		if (!(state & URWLOCK_WRITE_OWNER) && URWLOCK_READER_COUNT(state) == 0) {
+		if ((state & URWLOCK_WRITE_OWNER) == 0 &&
+		    URWLOCK_READER_COUNT(state) == 0) {
 			umtxq_unbusy_unlocked(&uq->uq_key);
 			error = umtxq_check_susp(td);
 			if (error != 0)
@@ -2908,9 +2913,10 @@ sleep:
 			error = EFAULT;
 			break;
 		}
-		suword32(&rwlock->rw_blocked_writers, blocked_writers+1);
+		suword32(&rwlock->rw_blocked_writers, blocked_writers + 1);
 
-		while ((state & URWLOCK_WRITE_OWNER) || URWLOCK_READER_COUNT(state) != 0) {
+		while ((state & URWLOCK_WRITE_OWNER) ||
+		    URWLOCK_READER_COUNT(state) != 0) {
 			umtxq_lock(&uq->uq_key);
 			umtxq_insert_queue(uq, UMTX_EXCLUSIVE_QUEUE);
 			umtxq_unbusy(&uq->uq_key);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201907050119.x651JSJX006825>