Skip to contentSkip to conversation

locking changes for v4.16

GIT PULL Ingo Molnar 1 participant 1 message Jan 29, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

Linus,

Please pull the latest locking-core-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git locking-core-for-linus

# HEAD: 05b93801a23c21a6f355f4c492c51715d6ccc96d lockdep: Convert some users to const

The main changes relate to making lock_is_held() et al (and external wrappers of them) work on const data types - this requires const propagation through the depths of lockdep. This removes a number of ugly type hacks the external helpers used.

Thanks,

Ingo

------------------>
Matthew Wilcox (3):
lockdep: Assign lock keys on registration
lockdep: Make lockdep checking constant
lockdep: Convert some users to const

 include/linux/backing-dev.h |  2 +-
 include/linux/lockdep.h     |  4 +-
 include/linux/srcu.h        |  4 +-
 include/net/sock.h          |  4 +-
 kernel/locking/lockdep.c    | 89 ++++++++++++++++++++++++---------------------
 5 files changed, 53 insertions(+), 50 deletions(-)
include/linux/backing-dev.h +1 -1
index e54e7e0033eb..3e4ce54d84ab 100644
@@ -332,7 +332,7 @@ static inline bool inode_to_wb_is_valid(struct inode *inode)
  * holding either @inode->i_lock, @inode->i_mapping->tree_lock, or the
  * associated wb's list_lock.
  */
-static inline struct bdi_writeback *inode_to_wb(struct inode *inode)
+static inline struct bdi_writeback *inode_to_wb(const struct inode *inode)
 {
 #ifdef CONFIG_LOCKDEP
 	WARN_ON_ONCE(debug_locks &&
include/linux/lockdep.h +2 -2
index 3251d9c0d313..864d6fc60fa6 100644
@@ -337,9 +337,9 @@ extern void lock_release(struct lockdep_map *lock, int nested,
 /*
  * Same "read" as for lock_acquire(), except -1 means any.
  */
-extern int lock_is_held_type(struct lockdep_map *lock, int read);
+extern int lock_is_held_type(const struct lockdep_map *lock, int read);
 
-static inline int lock_is_held(struct lockdep_map *lock)
+static inline int lock_is_held(const struct lockdep_map *lock)
 {
 	return lock_is_held_type(lock, -1);
 }
include/linux/srcu.h +2 -2
index 62be8966e837..33c1c698df09 100644
@@ -92,7 +92,7 @@ void synchronize_srcu(struct srcu_struct *sp);
  * relies on normal RCU, it can be called from the CPU which
  * is in the idle loop from an RCU point of view or offline.
  */
-static inline int srcu_read_lock_held(struct srcu_struct *sp)
+static inline int srcu_read_lock_held(const struct srcu_struct *sp)
 {
 	if (!debug_lockdep_rcu_enabled())
 		return 1;
@@ -101,7 +101,7 @@ static inline int srcu_read_lock_held(struct srcu_struct *sp)
 
 #else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
 
-static inline int srcu_read_lock_held(struct srcu_struct *sp)
+static inline int srcu_read_lock_held(const struct srcu_struct *sp)
 {
 	return 1;
 }
include/net/sock.h +1 -3
index 7a7b14e9628a..c4a424fe6fdd 100644
@@ -1445,10 +1445,8 @@ do {									\
 } while (0)
 
 #ifdef CONFIG_LOCKDEP
-static inline bool lockdep_sock_is_held(const struct sock *csk)
+static inline bool lockdep_sock_is_held(const struct sock *sk)
 {
-	struct sock *sk = (struct sock *)csk;
-
 	return lockdep_is_held(&sk->sk_lock) ||
 	       lockdep_is_held(&sk->sk_lock.slock);
 }
kernel/locking/lockdep.c +47 -42

162 lines not on this page · raw message