]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fix some bugs related to adaptive spinning:
authorAttilio Rao <attilio@FreeBSD.org>
Wed, 2 Sep 2009 17:33:51 +0000 (17:33 +0000)
committerAttilio Rao <attilio@FreeBSD.org>
Wed, 2 Sep 2009 17:33:51 +0000 (17:33 +0000)
commit8d3635c4dbe64a3fbc5694cc4df287bc660a55b4
tree6d6740433b14bf13d7e3fd94a480ec836e8f5f6c
parentc8e648e16768bdba73b8cc4b957907e2ac5fdc7c
Fix some bugs related to adaptive spinning:

In the lockmgr support:
- GIANT_RESTORE() is just called when the sleep finishes, so the current
  code can ends up into a giant unlock problem.  Fix it by appropriately
  call GIANT_RESTORE() when needed.  Note that this is not exactly ideal
  because for any interation of the adaptive spinning we drop and restore
  Giant, but the overhead should be not a factor.
- In the lock held in exclusive mode case, after the adaptive spinning is
  brought to completition, we should just retry to acquire the lock
  instead to fallthrough. Fix that.
- Fix a style nit

In the sx support:
- Call GIANT_SAVE() before than looping. This saves some overhead because
  in the current code GIANT_SAVE() is called several times.

Tested by: Giovanni Trematerra <giovanni dot trematerra at gmail dot com>
sys/kern/kern_lock.c
sys/kern/kern_sx.c