This patch does not change any functionality but makes the next patch
in this series easier to read.

Cc: Peter Zijlstra <[email protected]>
Cc: Waiman Long <[email protected]>
Cc: Johannes Berg <[email protected]>
Signed-off-by: Bart Van Assche <[email protected]>
---
 kernel/locking/lockdep.c | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 6d99f3f0757c..c936fce5b9d7 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -4478,14 +4478,12 @@ static void schedule_free_zapped_classes(void)
 }
 
 /*
- * Used in module.c to remove lock classes from memory that is going to be
- * freed; and possibly re-used by other modules.
- *
- * We will have had one sync_sched() before getting here, so we're guaranteed
- * nobody will look up these exact classes -- they're properly dead but still
- * allocated.
+ * Remove all lock classes from the class hash table and from the
+ * all_lock_classes list whose key or name is in the address range
+ * [start, start + size). Move these lock classes to the
+ * @zapped_classes list.
  */
-void lockdep_free_key_range(void *start, unsigned long size)
+static void __lockdep_free_key_range(void *start, unsigned long size)
 {
        struct lock_class *class;
        struct hlist_head *head;
@@ -4496,9 +4494,6 @@ void lockdep_free_key_range(void *start, unsigned long 
size)
        raw_local_irq_save(flags);
        locked = graph_lock();
 
-       /*
-        * Unhash all classes that were created by this module:
-        */
        for (i = 0; i < CLASSHASH_SIZE; i++) {
                head = classhash_table + i;
                hlist_for_each_entry_rcu(class, head, hash_entry) {
@@ -4513,7 +4508,19 @@ void lockdep_free_key_range(void *start, unsigned long 
size)
        if (locked)
                graph_unlock();
        raw_local_irq_restore(flags);
+}
 
+/*
+ * Used in module.c to remove lock classes from memory that is going to be
+ * freed; and possibly re-used by other modules.
+ *
+ * We will have had one sync_sched() before getting here, so we're guaranteed
+ * nobody will look up these exact classes -- they're properly dead but still
+ * allocated.
+ */
+void lockdep_free_key_range(void *start, unsigned long size)
+{
+       __lockdep_free_key_range(start, size);
        /*
         * Do not wait for concurrent look_up_lock_class() calls. If any such
         * concurrent call would return a pointer to one of the lock classes
-- 
2.20.0.rc1.387.gf8505762e3-goog

Reply via email to