1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-02-05 18:05:16 +00:00

- Use a different encoding for lockmgr options: make them encoded by

bit in order to allow per-bit checks on the options flag, in particular
  in the consumers code [1]
- Re-enable the check against TDP_DEADLKTREAT as the anti-waiters
  starvation patch allows exclusive waiters to override new shared
  requests.

[1] Requested by:	pjd, jeff
This commit is contained in:
Attilio Rao 2008-04-07 14:46:38 +00:00
parent fc9299dd1b
commit e0f62984c1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=177982
2 changed files with 22 additions and 22 deletions

View File

@ -88,7 +88,7 @@ CTASSERT(((LK_CANRECURSE | LK_NOSHARE) & LO_CLASSFLAGS) ==
((x) & LK_NOWAIT)
#define LK_CAN_SHARE(x) \
(((x) & LK_SHARE) && (((x) & LK_EXCLUSIVE_WAITERS) == 0 || \
curthread->td_lk_slocks))
curthread->td_lk_slocks || (curthread->td_pflags & TDP_DEADLKTREAT)))
#define lockmgr_disowned(lk) \
(((lk)->lk_lock & ~(LK_FLAGMASK & ~LK_SHARE)) == LK_KERNPROC)

View File

@ -133,35 +133,35 @@ _lockmgr_args_rw(struct lock *lk, u_int flags, struct rwlock *ilk,
/*
* Flags for lockinit().
*/
#define LK_INIT_MASK 0x000FF
#define LK_CANRECURSE 0x00001
#define LK_NODUP 0x00002
#define LK_NOPROFILE 0x00004
#define LK_NOSHARE 0x00008
#define LK_NOWITNESS 0x00010
#define LK_QUIET 0x00020
#define LK_INIT_MASK 0x0000FF
#define LK_CANRECURSE 0x000001
#define LK_NODUP 0x000002
#define LK_NOPROFILE 0x000004
#define LK_NOSHARE 0x000008
#define LK_NOWITNESS 0x000010
#define LK_QUIET 0x000020
/*
* Additional attributes to be used in lockmgr().
*/
#define LK_EATTR_MASK 0x0FF00
#define LK_INTERLOCK 0x00100
#define LK_NOWAIT 0x00200
#define LK_RETRY 0x00400
#define LK_SLEEPFAIL 0x00800
#define LK_TIMELOCK 0x01000
#define LK_EATTR_MASK 0x00FF00
#define LK_INTERLOCK 0x000100
#define LK_NOWAIT 0x000200
#define LK_RETRY 0x000400
#define LK_SLEEPFAIL 0x000800
#define LK_TIMELOCK 0x001000
/*
* Operations for lockmgr().
*/
#define LK_TYPE_MASK 0xF0000
#define LK_DOWNGRADE 0x10000
#define LK_DRAIN 0x20000
#define LK_EXCLOTHER 0x30000
#define LK_EXCLUSIVE 0x40000
#define LK_RELEASE 0x50000
#define LK_SHARED 0x60000
#define LK_UPGRADE 0x70000
#define LK_TYPE_MASK 0xFF0000
#define LK_DOWNGRADE 0x010000
#define LK_DRAIN 0x020000
#define LK_EXCLOTHER 0x040000
#define LK_EXCLUSIVE 0x080000
#define LK_RELEASE 0x100000
#define LK_SHARED 0x200000
#define LK_UPGRADE 0x400000
#define LK_TOTAL_MASK (LK_INIT_MASK | LK_EATTR_MASK | LK_TYPE_MASK)