Page MenuHomeFreeBSD

D28680.id83908.diff
No OneTemporary

D28680.id83908.diff

Index: sys/kern/kern_lock.c
===================================================================
--- sys/kern/kern_lock.c
+++ sys/kern/kern_lock.c
@@ -61,6 +61,12 @@
PMC_SOFT_DECLARE( , , lock, failed);
#endif
+/*
+ * Hack. There should be prio_t or similar so that this is not necessary.
+ */
+_Static_assert((PRILASTFLAG * 2) - 1 <= USHRT_MAX,
+ "prio flags wont fit in u_short pri in struct lock");
+
CTASSERT(LK_UNLOCKED == (LK_UNLOCKED &
~(LK_ALL_WAITERS | LK_EXCLUSIVE_SPINNERS)));
@@ -280,8 +286,10 @@
if (flags & LK_INTERLOCK)
class->lc_unlock(ilk);
- if (queue == SQ_EXCLUSIVE_QUEUE && (flags & LK_SLEEPFAIL) != 0)
- lk->lk_exslpfail++;
+ if (queue == SQ_EXCLUSIVE_QUEUE && (flags & LK_SLEEPFAIL) != 0) {
+ if (lk->lk_exslpfail < USHRT_MAX)
+ lk->lk_exslpfail++;
+ }
GIANT_SAVE();
sleepq_add(&lk->lock_object, NULL, wmesg, SLEEPQ_LK | (catch ?
SLEEPQ_INTERRUPTIBLE : 0), queue);
Index: sys/sys/_lockmgr.h
===================================================================
--- sys/sys/_lockmgr.h
+++ sys/sys/_lockmgr.h
@@ -40,9 +40,9 @@
struct lock {
struct lock_object lock_object;
volatile uintptr_t lk_lock;
- u_int lk_exslpfail;
+ u_short lk_exslpfail;
+ u_short lk_pri;
int lk_timo;
- int lk_pri;
#ifdef DEBUG_LOCKS
struct stack lk_stack;
#endif
Index: sys/sys/param.h
===================================================================
--- sys/sys/param.h
+++ sys/sys/param.h
@@ -227,9 +227,10 @@
((off_t)(db) << DEV_BSHIFT)
#endif
-#define PRIMASK 0x0ff
-#define PCATCH 0x100 /* OR'd with pri for tsleep to check signals */
-#define PDROP 0x200 /* OR'd with pri to stop re-entry of interlock mutex */
+#define PRIMASK 0x0ff
+#define PCATCH 0x100 /* OR'd with pri for tsleep to check signals */
+#define PDROP 0x200 /* OR'd with pri to stop re-entry of interlock mutex */
+#define PRILASTFLAG 0x200 /* Last flag defined above */
#define NZERO 0 /* default "nice" */

File Metadata

Mime Type
text/plain
Expires
Wed, Jul 22, 3:17 PM (5 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35369077
Default Alt Text
D28680.id83908.diff (1 KB)

Event Timeline