OpenBSD: don't use AFS_GLOBAL_SUNLOCK on single processor system
authorAntoine Verheijen <antoine@ualberta.ca>
Mon, 8 Feb 2010 21:57:51 +0000 (14:57 -0700)
committerDerrick Brashear <shadow@dementia.org>
Tue, 9 Feb 2010 16:41:55 +0000 (08:41 -0800)
Put back the header directives that only turns on AFS_GLOBAL_SUNLOCK
when compiling for multiprocessors system. When enabled on a single
processor OpenBSD system, it is possible to put the entire system
into a lengthy (minutes) lock state when performing multiple AFS
activities. The system behaves MUCH better when AFS_GLOBAL_SUNLOCK
is not set (no problems encopuntered). This whole locking mechanism
needs a bit more examination on OpenBSD before this is useful in
single processor mode.

Change-Id: I19813b78ad8d705b4f043ccb3a38c83e278972e9
Reviewed-on: http://gerrit.openafs.org/1276
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

src/afs/OBSD/osi_machdep.h
src/config/param.obsd44.h
src/config/param.obsd45.h
src/config/param.obsd46.h

index 5e03708..e1b9000 100644 (file)
@@ -154,70 +154,70 @@ extern int afs_vget();
 extern struct lock afs_global_lock;
 extern struct proc *afs_global_owner;
 
-#ifdef AFS_GLOBAL_SUNLOCK
+# ifdef AFS_GLOBAL_SUNLOCK
 
-#if defined(LOCKDEBUG)
+#  if defined(LOCKDEBUG)
 
-#define AFS_GLOCK() \
+#   define AFS_GLOCK() \
   do { \
   _lockmgr(&afs_global_lock, LK_EXCLUSIVE, NULL, __FILE__, __LINE__); \
   } while(0);
-#define AFS_GUNLOCK() \
+#   define AFS_GUNLOCK() \
   do { \
   _lockmgr(&afs_global_lock, LK_RELEASE, NULL, __FILE__, __LINE__); \
   } while(0);
 
-#else
+#  else /* LOCKDEBUG */
 
-#define AFS_GLOCK() \
+#   define AFS_GLOCK() \
   do { \
   lockmgr(&afs_global_lock, LK_EXCLUSIVE, NULL); \
   } while(0);
-#define AFS_GUNLOCK() \
+#   define AFS_GUNLOCK() \
   do { \
   lockmgr(&afs_global_lock, LK_RELEASE, NULL); \
   } while(0);
-#endif /* LOCKDEBUG */
-#define ISAFS_GLOCK() (lockstatus(&afs_global_lock) == LK_EXCLUSIVE)
-#else
+#  endif /* LOCKDEBUG */
+#  define ISAFS_GLOCK() (lockstatus(&afs_global_lock) == LK_EXCLUSIVE)
+# else /* AFS_GLOBAL_SUNLOCK */
 extern struct lock afs_global_lock;
-#define AFS_GLOCKP(p)
-#define AFS_GUNLOCKP(p)
-#define AFS_ASSERT_GLOCK()
-#define ISAFS_GLOCK() 1
-#endif
+#  define AFS_GLOCK()
+#  define AFS_GUNLOCK()
+#  define AFS_ASSERT_GLOCK()
+#  define ISAFS_GLOCK() 1
+# endif
 
-#else
+#else /* AFS_OBSD44_ENV */
 /* I don't see doing locks this way for older kernels, either,
  * but, smart folks wrote this
  */
 #define AFS_GLOCK() AFS_GLOCKP(curproc)
 #define AFS_GUNLOCK() AFS_GUNLOCKP(curproc)
-#ifdef AFS_GLOBAL_SUNLOCK
+# ifdef AFS_GLOBAL_SUNLOCK
 extern struct proc *afs_global_owner;
 extern struct lock afs_global_lock;
-#define AFS_GLOCKP(p) \
+#  define AFS_GLOCKP(p) \
     do { \
         osi_Assert(p); \
        afs_osi_lockmgr(&afs_global_lock, LK_EXCLUSIVE, 0, (p)); \
         osi_Assert(afs_global_owner == NULL); \
        afs_global_owner = (p); \
     } while (0)
-#define AFS_GUNLOCKP(p) \
+#  define AFS_GUNLOCKP(p) \
     do { \
         osi_Assert(p); \
        osi_Assert(afs_global_owner == (p)); \
         afs_global_owner = NULL; \
         afs_osi_lockmgr(&afs_global_lock, LK_RELEASE, 0, (p)); \
     } while(0)
-#define ISAFS_GLOCK() (afs_global_owner == curproc && curproc)
-#else
+#  define ISAFS_GLOCK() (afs_global_owner == curproc && curproc)
+# else /* AFS_GLOBAL_SUNLOCK */
 extern struct lock afs_global_lock;
-#define AFS_GLOCKP(p)
-#define AFS_GUNLOCKP(p)
-#define AFS_ASSERT_GLOCK()
-#define ISAFS_GLOCK() 1
-#endif
+#  define AFS_GLOCKP(p)
+#  define AFS_GUNLOCKP(p)
+#  define AFS_ASSERT_GLOCK()
+#  define ISAFS_GLOCK() 1
+# endif
 
 #endif /* AFS_OBSD44_ENV */
 
index f950b50..9d9db33 100644 (file)
@@ -54,7 +54,9 @@
 
 /* Extra kernel definitions (from kdefs file) */
 #ifdef _KERNEL
+#ifdef MULTIPROCESSOR
 #define AFS_GLOBAL_SUNLOCK     1
+#endif
 #define        AFS_SHORTGID            0       /* are group id's short? */
 
 #if    !defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__)
index 9fd79f0..a268c1a 100644 (file)
@@ -54,7 +54,9 @@
 
 /* Extra kernel definitions (from kdefs file) */
 #ifdef _KERNEL
+#ifdef MULTIPROCESSOR
 #define AFS_GLOBAL_SUNLOCK     1
+#endif
 #define        AFS_SHORTGID            0       /* are group id's short? */
 
 #if    !defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__)
index 38786ad..24a9228 100644 (file)
@@ -55,7 +55,9 @@
 
 /* Extra kernel definitions (from kdefs file) */
 #ifdef _KERNEL
+#ifdef MULTIPROCESSOR
 #define AFS_GLOBAL_SUNLOCK     1
+#endif
 #define        AFS_SHORTGID            0       /* are group id's short? */
 
 #if    !defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__)