[PATCH] Revert "lockdep: Swap storage for pin_count and references"

Nirmoy Das nirmoy.das at intel.com
Tue Apr 25 09:36:35 UTC 2023


This reverts commit f0ae5cdbcc481193e8d5b7f139d52e69cd7aa163.
---
 include/linux/lockdep.h  |  4 ++--
 kernel/locking/lockdep.c | 11 ++++-------
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 555fecb8ee31..1023f349af71 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -134,8 +134,8 @@ struct held_lock {
 	unsigned int read:2;        /* see lock_acquire() comment */
 	unsigned int check:1;       /* see lock_acquire() comment */
 	unsigned int hardirqs_off:1;
-	unsigned int pin_count:12;					/* 32 bits */
-	unsigned int references;
+	unsigned int references:12;					/* 32 bits */
+	unsigned int pin_count;
 };
 
 /*
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 412083e3ab10..50d4863974e7 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -5432,14 +5432,11 @@ static struct pin_cookie __lock_pin_lock(struct lockdep_map *lock)
 
 		if (match_held_lock(hlock, lock)) {
 			/*
-			 * Grab 6bits of randomness; this is barely sufficient
-			 * to not be guessable and still allows some 32 levels
-			 * of pin nesting in our u12 pin_count.
+			 * Grab 16bits of randomness; this is sufficient to not
+			 * be guessable and still allows some pin nesting in
+			 * our u32 pin_count.
 			 */
-			cookie.val = 1 + (sched_clock() & 0x3f);
-			if (DEBUG_LOCKS_WARN_ON(hlock->pin_count + cookie.val >= 1 << 12))
-				return NIL_COOKIE;
-
+			cookie.val = 1 + (sched_clock() & 0xffff);
 			hlock->pin_count += cookie.val;
 			return cookie;
 		}
-- 
2.39.0



More information about the Intel-gfx-trybot mailing list