[PATCH]: small speedup to filedesc

Divacky Roman xdivac02 at stud.fit.vutbr.cz
Sun Mar 5 17:53:41 UTC 2006


hi

this:

Index: filedesc.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/filedesc.h,v
retrieving revision 1.73
diff -u -r1.73 filedesc.h
--- filedesc.h	14 Sep 2005 14:57:04 -0000	1.73
+++ filedesc.h	5 Mar 2006 17:48:19 -0000
@@ -118,6 +118,7 @@
 		mtx_unlock(&(fd)->fd_mtx);						\
 	} while (0)
 
+#ifdef	SMP
 #define	FILEDESC_LOCK_FAST(fd)								\
 	do {										\
 		mtx_lock(&(fd)->fd_mtx);						\
@@ -137,7 +138,10 @@
 			wakeup(&(fd)->fd_locked);					\
 		mtx_unlock(&(fd)->fd_mtx);						\
 	} while (0)
-
+#else
+#define FILEDESC_LOCK_FAST(fdp)		critical_enter()
+#define FILEDESC_UNLOCK_FAST(fdp)	critical_exit()
+#endif	/* SMP */
 #ifdef INVARIANT_SUPPORT
 #define	FILEDESC_LOCK_ASSERT(fd, arg)							\
 	do {										\

leads to: 

Difference at 95.0% confidence
        -39.6 +/- 10.473
	-3.40031% +/- 0.899276%
	(Student's t, pooled s = 14.0046)

in a benchmark which basically fstat()es /dev/ttyv[0-9] (its available on
hysteria.sk/~neologism/filedesc.tar)

the patch was discussed with Suleiman Souhlal

roman


More information about the freebsd-current mailing list