Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Dec 2016 19:07:31 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r309751 - head/sys/kern
Message-ID:  <201612091907.uB9J7VHu015907@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Fri Dec  9 19:07:31 2016
New Revision: 309751
URL: https://svnweb.freebsd.org/changeset/base/309751

Log:
  Use acquire write to cr_lock to complement with release write at end
  of locked region.
  
  Submitted by:	kib

Modified:
  head/sys/kern/subr_counter.c

Modified: head/sys/kern/subr_counter.c
==============================================================================
--- head/sys/kern/subr_counter.c	Fri Dec  9 18:55:27 2016	(r309750)
+++ head/sys/kern/subr_counter.c	Fri Dec  9 19:07:31 2016	(r309751)
@@ -144,7 +144,7 @@ counter_ratecheck(struct counter_rate *c
 		 * First try unlocked read, and then proceed with atomic.
 		 */
 		if ((cr->cr_lock == 0) &&
-		    atomic_cmpset_int(&cr->cr_lock, 0, 1)) {
+		    atomic_cmpset_acq_int(&cr->cr_lock, 0, 1)) {
 			/*
 			 * Check if other thread has just went through the
 			 * reset sequence before us.



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