[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: NPTL per char IO locking broken



This looks like the right patch that's missing in debian glibc.
Just about to compile and test. ~mc

On 03/15/04 23:21, Michael Clark wrote:
Just doing some tests with bonnie++ on 2.6.3 with latest glibc in sid
and noticing per char IO is dreadfully slow. Remember a thread months
back about this on LKML: http://kerneltrap.org/node/view/1574

--- glibc-debian/nptl/sysdeps/pthread/bits/stdio-lock.h	2003-09-01 03:07:32.000000000 +0800
+++ glibc-cvs/nptl/sysdeps/pthread/bits/stdio-lock.h	2003-11-05 07:43:10.000000000 +0800
@@ -29,7 +29,7 @@
 
 typedef struct { int lock; int cnt; void *owner; } _IO_lock_t;
 
-#define _IO_lock_initializer { LLL_MUTEX_LOCK_INITIALIZER, 0, NULL }
+#define _IO_lock_initializer { LLL_LOCK_INITIALIZER, 0, NULL }
 
 #define _IO_lock_init(_name) \
   ((_name) = (_IO_lock_t) _IO_lock_initializer , 0)
@@ -42,7 +42,7 @@
     void *__self = THREAD_SELF;						      \
     if ((_name).owner != __self)					      \
       {									      \
-        lll_mutex_lock ((_name).lock);					      \
+        lll_lock ((_name).lock);					      \
         (_name).owner = __self;						      \
       }									      \
     ++(_name).cnt;							      \
@@ -54,7 +54,7 @@
     void *__self = THREAD_SELF;						      \
     if ((_name).owner != __self)					      \
       {									      \
-        if (lll_mutex_trylock ((_name).lock) == 0)			      \
+        if (lll_trylock ((_name).lock) == 0)				      \
           {								      \
             (_name).owner = __self;					      \
             (_name).cnt = 1;						      \
@@ -72,7 +72,7 @@
     if (--(_name).cnt == 0)						      \
       {									      \
         (_name).owner = NULL;						      \
-        lll_mutex_unlock ((_name).lock);				      \
+        lll_unlock ((_name).lock);					      \
       }									      \
   } while (0)
 

Reply to: