Skip to contentSkip to conversation

locking-lockdep-add-sequence-counter-to-held_lock.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Aug 25

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: locking/lockdep: add sequence counter to held_lock
has been removed from the -mm tree. Its filename was
locking-lockdep-add-sequence-counter-to-held_lock.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: "Liam R. Howlett (Oracle)" <[email protected]>
Subject: locking/lockdep: add sequence counter to held_lock
Date: Fri, 21 Aug 2026 15:26:10 -0400

Add an 8 bit small sequence counter to the held_lock struct to detect if the lock as been dropped and reacquired. This is useful when a data structure depends on a constant locking context, but is not able to detect locking and unlocking of the lock through its own API.

Since the __lock_unpin_lock() will no longer detect underflow by casting the unsigned int to a signed int, update the casting code to use a temp variable for calculations using a signed int.

---

 include/linux/lockdep.h       |    3 +
 include/linux/lockdep_types.h |    3 +
 include/linux/sched.h         |    1 
 kernel/locking/lockdep.c      |   58 ++++++++++++++++++++++++++++----
 4 files changed, 57 insertions(+), 8 deletions(-)
include/linux/lockdep.h renamed from include/linux/lockdep.h~locking-lockdep-add-sequence-counter-to-held_lock +3 -0
@@ -273,6 +273,9 @@ extern struct pin_cookie lock_pin_lock(s
 extern void lock_repin_lock(struct lockdep_map *lock, struct pin_cookie);
 extern void lock_unpin_lock(struct lockdep_map *lock, struct pin_cookie);
 
+extern u32 lock_sequence(struct lockdep_map *lock);
+#define lockdep_sequence(lock)	lock_sequence(&(lock)->dep_map)
+
 #define lockdep_depth(tsk)	(debug_locks ? (tsk)->lockdep_depth : 0)
 
 #define lockdep_assert(cond)		\
include/linux/lockdep_types.h renamed from include/linux/lockdep_types.h~locking-lockdep-add-sequence-counter-to-held_lock +2 -1
@@ -253,7 +253,8 @@ struct held_lock {
 	unsigned int hardirqs_off:1;
 	unsigned int sync:1;
 	unsigned int references:11;					/* 32 bits */
-	unsigned int pin_count;
+	unsigned int pin_count:24;
+	unsigned int seq_count:8;
 };
 
 #else /* !CONFIG_LOCKDEP */
include/linux/sched.h renamed from include/linux/sched.h~locking-lockdep-add-sequence-counter-to-held_lock +1 -0
@@ -1288,6 +1288,7 @@ struct task_struct {
 	u64				curr_chain_key;
 	int				lockdep_depth;
 	unsigned int			lockdep_recursion;
+	unsigned int			lockdep_seq;
 	struct held_lock		held_locks[MAX_LOCK_DEPTH];
 #endif
 
kernel/locking/lockdep.c renamed from kernel/locking/lockdep.c~locking-lockdep-add-sequence-counter-to-held_lock +51 -7

111 lines not on this page · raw message

_

Patches currently in -mm which might be from [email protected] are