PERFORCE change 103233 for review

Roman Divacky rdivacky at FreeBSD.org
Sat Aug 5 08:41:50 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=103233

Change 103233 by rdivacky at 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;
 }


More information about the p4-projects mailing list