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.
      .-'---`-.			      .-'---`-.
    ,'          `.		    ,'          `.
    |             \		    |             \
    |              \		    |              \
    \           _  \		    \           _  \
    ,\  _    ,'-,/-)\		    ,\  _    ,'-,/-)\
    ( * \ \,' ,' ,'-)		    ( * \ \,' ,' ,'-)
     `._,)     -',-')		     `._,)     -',-')
       \/         ''/		       \/         ''/
        )        / /		        )        / /
       /       ,'-'		       /       ,'-'
This commit is contained in:
Mateusz Guzik 2018-03-02 21:26:27 +00:00
parent 9589b9f57b
commit c505b59961
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=330294

View File

@ -584,7 +584,7 @@ _sx_xlock_hard(struct sx *sx, uintptr_t x, int opts LOCK_FILE_LINE_ARG_DEF)
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 LOCK_FILE_LINE_ARG_DEF)
#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