summaryrefslogtreecommitdiffstats
path: root/sys/sys/lock.h
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2008-05-15 20:10:06 +0000
committerattilio <attilio@FreeBSD.org>2008-05-15 20:10:06 +0000
commitf7f31164f19cdffc5fc75cde6ac6d025b796f980 (patch)
tree4a7012a0d4693359153827067b7671780eaffb71 /sys/sys/lock.h
parent65c049483295f418e34fa09dc07b3656d53df907 (diff)
downloadFreeBSD-src-f7f31164f19cdffc5fc75cde6ac6d025b796f980.zip
FreeBSD-src-f7f31164f19cdffc5fc75cde6ac6d025b796f980.tar.gz
- Embed the recursion counter for any locking primitive directly in the
lock_object, using an unified field called lo_data. - Replace lo_type usage with the w_name usage and at init time pass the lock "type" directly to witness_init() from the parent lock init function. Handle delayed initialization before than witness_initialize() is called through the witness_pendhelp structure. - Axe out LO_ENROLLPEND as it is not really needed. The case where the mutex init delayed wants to be destroyed can't happen because witness_destroy() checks for witness_cold and panic in case. - In enroll(), if we cannot allocate a new object from the freelist, notify that to userspace through a printf(). - Modify the depart function in order to return nothing as in the current CVS version it always returns true and adjust callers accordingly. - Fix the witness_addgraph() argument name prototype. - Remove unuseful code from itismychild(). This commit leads to a shrinked struct lock_object and so smaller locks, in particular on amd64 where 2 uintptr_t (16 bytes per-primitive) are gained. Reviewed by: jhb
Diffstat (limited to 'sys/sys/lock.h')
-rw-r--r--sys/sys/lock.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/sys/lock.h b/sys/sys/lock.h
index 2e94120..2bde087 100644
--- a/sys/sys/lock.h
+++ b/sys/sys/lock.h
@@ -78,7 +78,6 @@ struct lock_class {
#define LO_SLEEPABLE 0x00100000 /* Lock may be held while sleeping. */
#define LO_UPGRADABLE 0x00200000 /* Lock may be upgraded/downgraded. */
#define LO_DUPOK 0x00400000 /* Don't check for duplicate acquires */
-#define LO_ENROLLPEND 0x00800000 /* On the pending enroll list. */
#define LO_CLASSMASK 0x0f000000 /* Class index bitmask. */
#define LO_NOPROFILE 0x10000000 /* Don't profile this lock */
@@ -201,7 +200,7 @@ void lock_init(struct lock_object *, struct lock_class *,
void lock_destroy(struct lock_object *);
void spinlock_enter(void);
void spinlock_exit(void);
-void witness_init(struct lock_object *);
+void witness_init(struct lock_object *, const char *);
void witness_destroy(struct lock_object *);
int witness_defineorder(struct lock_object *, struct lock_object *);
void witness_checkorder(struct lock_object *, int, const char *, int);
@@ -225,8 +224,8 @@ const char *witness_file(struct lock_object *);
#define WARN_PANIC 0x02 /* Panic if check fails. */
#define WARN_SLEEPOK 0x04 /* Sleepable locks are exempt from check. */
-#define WITNESS_INIT(lock) \
- witness_init((lock))
+#define WITNESS_INIT(lock, type) \
+ witness_init((lock), (type))
#define WITNESS_DESTROY(lock) \
witness_destroy(lock)
@@ -273,7 +272,7 @@ const char *witness_file(struct lock_object *);
witness_line(lock)
#else /* WITNESS */
-#define WITNESS_INIT(lock)
+#define WITNESS_INIT(lock, type)
#define WITNESS_DESTROY(lock)
#define WITNESS_DEFINEORDER(lock1, lock2) 0
#define WITNESS_CHECKORDER(lock, flags, file, line)
OpenPOWER on IntegriCloud