Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Aug 2006 08:41:49 GMT
From:      Roman Divacky <rdivacky@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 103233 for review
Message-ID:  <200608050841.k758fnOK032152@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=103233

Change 103233 by rdivacky@rdivacky_witten on 2006/08/05 08:41:12

	Remove the atomic_* handling of refcount and extend the FUTEX_LOCK() coverage in futex_put.
	
	Pointed out by: jhb

Affected files ...

.. //depot/projects/soc2006/rdivacky_linuxolator/compat/linux/linux_futex.c#16 edit

Differences ...

==== //depot/projects/soc2006/rdivacky_linuxolator/compat/linux/linux_futex.c#16 (text+ko) ====

@@ -274,7 +274,7 @@
 	FUTEX_LOCK;
 	LIST_FOREACH(f, &futex_list, f_list) {
 		if (f->f_uaddr == uaddr) {
-			atomic_add_int(&f->f_refcount, 1);
+			f->f_refcount++;
 			FUTEX_UNLOCK;
 			return f;
 		}
@@ -297,12 +297,13 @@
 futex_put(f)
 	struct futex *f;
 {
-	if (atomic_fetchadd_int(&f->f_refcount, -1) == 1) {
-		FUTEX_LOCK;
+   	FUTEX_LOCK;
+   	f->f_refcount--;
+	if (f->f_refcount == 0) {
 		LIST_REMOVE(f, f_list);
-		FUTEX_UNLOCK;
 		free(f, M_LINUX);
 	}
+	FUTEX_UNLOCK;
 
 	return;
 }



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