lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 24 Apr 2019 18:19:32 +0800
From:   Yuyang Du <duyuyang@...il.com>
To:     peterz@...radead.org, will.deacon@....com, mingo@...nel.org
Cc:     bvanassche@....org, ming.lei@...hat.com, frederic@...nel.org,
        tglx@...utronix.de, linux-kernel@...r.kernel.org,
        Yuyang Du <duyuyang@...il.com>
Subject: [PATCH 26/28] locking/lockdep: Remove __bfs

Since there is no need for backward dependecy searching, remove this
extra function layer.

Signed-off-by: Yuyang Du <duyuyang@...il.com>
---
 kernel/locking/lockdep.c | 40 +++++++---------------------------------
 1 file changed, 7 insertions(+), 33 deletions(-)

diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 06ae87f..acaa3b3 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -1393,27 +1393,13 @@ static inline int get_lock_depth(struct lock_list *child)
 }
 
 /*
- * Return the forward or backward dependency list.
- *
- * @lock:   the lock_list to get its class's dependency list
- * @offset: the offset to struct lock_class to determine whether it is
- *          locks_after or locks_before
- */
-static inline struct list_head *get_dep_list(struct lock_list *lock, int offset)
-{
-	void *lock_class = lock->class;
-
-	return lock_class + offset;
-}
-
-/*
- * Forward- or backward-dependency search, used for both circular dependency
+ * Forward-dependency search, used for both circular dependency
  * checking and hardirq-unsafe/softirq-unsafe checking.
  */
-static int __bfs(struct lock_list *source_entry, void *data,
-		 int (*match)(struct lock_list *entry, void *data),
-		 struct lock_list **target_entry, int offset, int index,
-		 int distance, struct lock_class *safe_lock, bool reach)
+static int __bfs_forwards(struct lock_list *source_entry, void *data,
+			  int (*match)(struct lock_list *entry, void *data),
+			  struct lock_list **target_entry, int index,
+			  int distance, struct lock_class *safe_lock, bool reach)
 {
 	struct lock_list *entry;
 	struct lock_list *lock;
@@ -1429,7 +1415,7 @@ static int __bfs(struct lock_list *source_entry, void *data,
 		goto exit;
 	}
 
-	head = get_dep_list(source_entry, offset);
+	head = &source_entry->class->locks_after;
 	if (list_empty(head))
 		goto exit;
 
@@ -1443,7 +1429,7 @@ static int __bfs(struct lock_list *source_entry, void *data,
 			goto exit;
 		}
 
-		head = get_dep_list(lock, offset);
+		head = &lock->class->locks_after;
 
 		DEBUG_LOCKS_WARN_ON(!irqs_disabled());
 
@@ -1475,18 +1461,6 @@ static int __bfs(struct lock_list *source_entry, void *data,
 	return ret;
 }
 
-static inline int __bfs_forwards(struct lock_list *src_entry, void *data,
-				 int (*match)(struct lock_list *entry, void *data),
-				 struct lock_list **target_entry, int index,
-				 int distance, struct lock_class *safe_lock,
-				 bool reach)
-{
-	return __bfs(src_entry, data, match, target_entry,
-		     offsetof(struct lock_class, locks_after),
-		     index, distance, safe_lock, reach);
-
-}
-
 static void print_lock_trace(struct lock_trace *trace, unsigned int spaces)
 {
 	unsigned long *entries = stack_trace + trace->offset;
-- 
1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ