svn commit: r330294 - head/sys/kern
Mateusz Guzik
mjg at FreeBSD.org
Fri Mar 2 21:26:32 UTC 2018
Author: mjg
Date: Fri Mar 2 21:26:27 2018
New Revision: 330294
URL: https://svnweb.freebsd.org/changeset/base/330294
Log:
sx: fix adaptive spinning broken in r327397
The condition was flipped.
In particular heavy multithreaded kernel builds on zfs started suffering
due to nested sx locks.
For instance make -s -j 128 buildkernel:
before: 3326.67s user 1269.62s system 6981% cpu 1:05.84 total
after: 3365.55s user 911.27s system 6871% cpu 1:02.24 total
ps.
.-'---`-. .-'---`-.
,' `. ,' `.
| \ | \
| \ | \
\ _ \ \ _ \
,\ _ ,'-,/-)\ ,\ _ ,'-,/-)\
( * \ \,' ,' ,'-) ( * \ \,' ,' ,'-)
`._,) -',-') `._,) -',-')
\/ ''/ \/ ''/
) / / ) / /
/ ,'-' / ,'-'
Modified:
head/sys/kern/kern_sx.c
Modified: head/sys/kern/kern_sx.c
==============================================================================
--- head/sys/kern/kern_sx.c Fri Mar 2 20:59:36 2018 (r330293)
+++ head/sys/kern/kern_sx.c Fri Mar 2 21:26:27 2018 (r330294)
@@ -584,7 +584,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t x, int opts LO
sx->lock_object.lo_name, (void *)sx->sx_lock, file, line);
#ifdef ADAPTIVE_SX
- adaptive = ((sx->lock_object.lo_flags & SX_NOADAPTIVE) != 0);
+ adaptive = ((sx->lock_object.lo_flags & SX_NOADAPTIVE) == 0);
#endif
#ifdef HWPMC_HOOKS
@@ -937,7 +937,7 @@ _sx_slock_hard(struct sx *sx, int opts, uintptr_t x LO
#endif
#ifdef ADAPTIVE_SX
- adaptive = ((sx->lock_object.lo_flags & SX_NOADAPTIVE) != 0);
+ adaptive = ((sx->lock_object.lo_flags & SX_NOADAPTIVE) == 0);
#endif
#ifdef HWPMC_HOOKS
More information about the svn-src-all
mailing list