From 48062565def6f202e877dafe111cc5836f4b71b7 Mon Sep 17 00:00:00 2001 From: ssouhlal Date: Thu, 6 Apr 2006 16:27:48 +0000 Subject: [PATCH] Replace FILEDESC_[UN]LOCK_FAST() with a critical section on UP. Gives a small but measurable performance improvement. Submitted by: Divacky Roman MFC after: 1 month --- sys/sys/filedesc.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/sys/filedesc.h b/sys/sys/filedesc.h index 661fa5e72fd4f5..9ef3e482d6fd9d 100644 --- a/sys/sys/filedesc.h +++ b/sys/sys/filedesc.h @@ -118,6 +118,7 @@ struct filedesc_to_leader { mtx_unlock(&(fd)->fd_mtx); \ } while (0) +#ifdef SMP #define FILEDESC_LOCK_FAST(fd) \ do { \ mtx_lock(&(fd)->fd_mtx); \ @@ -137,7 +138,10 @@ struct filedesc_to_leader { 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 { \