Annotate Giant drop/pickup macros with __predict_false
They are used in important places of the kernel with the lock not being held majority of the time. Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
afacf95d5c
commit
6e8c1ccbe2
@ -96,14 +96,14 @@ CTASSERT(LK_UNLOCKED == (LK_UNLOCKED &
|
||||
int _i = 0; \
|
||||
WITNESS_SAVE_DECL(Giant)
|
||||
#define GIANT_RESTORE() do { \
|
||||
if (_i > 0) { \
|
||||
if (__predict_false(_i > 0)) { \
|
||||
while (_i--) \
|
||||
mtx_lock(&Giant); \
|
||||
WITNESS_RESTORE(&Giant.lock_object, Giant); \
|
||||
} \
|
||||
} while (0)
|
||||
#define GIANT_SAVE() do { \
|
||||
if (mtx_owned(&Giant)) { \
|
||||
if (__predict_false(mtx_owned(&Giant))) { \
|
||||
WITNESS_SAVE(&Giant.lock_object, Giant); \
|
||||
while (mtx_owned(&Giant)) { \
|
||||
_i++; \
|
||||
|
@ -496,7 +496,7 @@ do { \
|
||||
int _giantcnt = 0; \
|
||||
WITNESS_SAVE_DECL(Giant); \
|
||||
\
|
||||
if (mtx_owned(&Giant)) { \
|
||||
if (__predict_false(mtx_owned(&Giant))) { \
|
||||
WITNESS_SAVE(&Giant.lock_object, Giant); \
|
||||
for (_giantcnt = 0; mtx_owned(&Giant) && \
|
||||
!SCHEDULER_STOPPED(); _giantcnt++) \
|
||||
@ -509,7 +509,7 @@ do { \
|
||||
|
||||
#define PARTIAL_PICKUP_GIANT() \
|
||||
mtx_assert(&Giant, MA_NOTOWNED); \
|
||||
if (_giantcnt > 0) { \
|
||||
if (__predict_false(_giantcnt > 0)) { \
|
||||
while (_giantcnt--) \
|
||||
mtx_lock(&Giant); \
|
||||
WITNESS_RESTORE(&Giant.lock_object, Giant); \
|
||||
|
Loading…
x
Reference in New Issue
Block a user